{"id":14035,"date":"2020-03-12T21:27:43","date_gmt":"2020-03-12T21:27:43","guid":{"rendered":"https:\/\/ittutorial.org\/?p=14035"},"modified":"2020-10-16T14:12:13","modified_gmt":"2020-10-16T14:12:13","slug":"usefull-scripts-for-couchbase-dba","status":"publish","type":"post","link":"https:\/\/ittutorial.org\/usefull-scripts-for-couchbase-dba\/","title":{"rendered":"Usefull Scripts For Couchbase Dba"},"content":{"rendered":"<h1 class=\"page\">Why Couchbase?<\/h1>\n<div id=\"preamble\">\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>Today\u2019s mission-critical applications demand support for millions of interactions with end-users. Traditional databases were built for thousands. Designed for consistency and control, they lack agility, flexibility, and scalability. To execute multiple use cases, organizations are forced to deploy multiple types of databases, resulting in a &#8220;database sprawl&#8221; &#8211; and inefficiency, sluggish time to market, and poor customer experience. Traditional transactional and analytical databases predate today\u2019s cloud-everywhere reality. A cloud-native data management platform offers you a real competitive edge.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Enterprises are realizing that the requirements for extraordinary customer engagement can\u2019t be met just at the app tier. Building a great looking and well-designed app is just a start. The underlying database is what makes the difference. An Engagement Database powers multiple interactions and experiences by liberating the full potential of data, at any scale, across any channel or device, in order to drive a more meaningful relationship.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Couchbase Server is an open source, distributed, NoSQL document-oriented engagement database. It exposes a fast key-value store with managed cache for sub-millisecond data operations, purpose-built indexers for fast queries and a powerful query engine for executing SQL-like queries. For mobile and Internet of Things environments Couchbase also runs natively on-device and manages synchronization to the server.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Couchbase Server is specialized to provide low-latency data management for large-scale interactive web, mobile, and IoT applications. Common requirements that Couchbase Server was designed to satisfy include:<\/p>\n<\/div>\n<div class=\"ulist\">\n<ul>\n<li>Unified Programming Interface<\/li>\n<li>Query<\/li>\n<li>Search<\/li>\n<li>Mobile and IoT<\/li>\n<li>Analytics<\/li>\n<li>Core database engine<\/li>\n<li>Scale-out architecture<\/li>\n<li>Memory-first architecture<\/li>\n<li>Big data and SQL integrations<\/li>\n<li>Full-stack security<\/li>\n<li>Container and Cloud deployments<\/li>\n<li>High Availability<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif\">Couchbase <\/span>scripts for dbas<\/p>\n<p>Couchbase is also faster in reading and writing than other open source databases.<\/p>\n<p>Upgrade is zero downtime.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-14036 aligncenter\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2020\/03\/couchbase-300x146.png\" alt=\"\" width=\"300\" height=\"146\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2020\/03\/couchbase-300x146.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2020\/03\/couchbase.png 322w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Doc for <span style=\"font-family: arial, helvetica, sans-serif\">Couchbase<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/docs.couchbase.com\/server\/6.5\/getting-started\/start-here.html\">https:\/\/docs.couchbase.com\/server\/6.5\/getting-started\/start-here.html<\/a><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif\">Video education for Couchbase<\/span><\/p>\n<p><a href=\"https:\/\/learn.couchbase.com\/store\"><span style=\"font-family: arial, helvetica, sans-serif\">https:\/\/learn.couchbase.com\/store<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Enterprise and Comminity differences<\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/products\/editions\">https:\/\/www.couchbase.com\/products\/editions<\/a><\/p>\n<p>&nbsp;<\/p>\n<pre><\/pre>\n<p>&nbsp;<\/p>\n<pre>export JAVA_HOME=\/usr\/java\/jre1.8.0_241-amd64\r\nexport PATH=$PATH:$JAVA_HOME\/bin\r\nexport CAUCHBASE_HOME=\/opt\/couchbase\r\nexport PATH=$PATH:$CAUCHBASE_HOME\/bin\r\nexport LD_LIBRARY_PATH=\/opt\/couchbase\/lib\r\nexport CLASSPATH=$CLASSPATH:\/opt\/couchbase\/lib\/*\r\nexport PYTHONPATH=\/opt\/couchbase\/lib\/python<\/pre>\n<pre>#Install cauchbase\r\nwget https:\/\/packages.couchbase.com\/releases\/6.0.0\/couchbase-server-community-6.0.0-centos7.x86_64.rpm\r\nrpm -ivh couchbase-server-community-6.0.0-centos7.x86_64.rpm\r\n\r\n\r\n\r\n<\/pre>\n<pre>#Start couchbase\r\nsystemctl enable couchbase-server\r\nsystemctl start couchbase-server\r\nsystemctl status couchbase-server\r\n\r\n\r\n<\/pre>\n<pre>#bucket-create\r\ncouchbase-cli bucket-create --cluster=192.168.56.74:8091 --user Administrator --password password --bucket travel-data --bucket-type couchbase --bucket-ramsize 100 --bucket-replica 1 --compression-mode active<\/pre>\n<pre>#backup\r\nmkdir -p \/tmp\/cbbackup\/\r\ncd \/opt\/couchbase\/bin\r\ncbbackup http:\/\/192.168.56.74:8091 \/tmp\/cbbackup\/ -u Administrator -p password\r\n\r\n<\/pre>\n<pre>#restore<\/pre>\n<pre><\/pre>\n<pre>cbrestore \/tmp\/cbbackup http:\/\/192.168.56.74:8091 -u Administrator -p password --bucket-source=travel-data --bucket-destination=travel-data<\/pre>\n<pre>#Audit setting\r\ncouchbase-cli setting-audit -c 192.168.56.74:8091 --username Administrator \\\r\n--password password --audit-enabled 1 --audit-log-rotate-interval 604800 \\\r\n--audit-log-path \/opt\/couchbase\/var\/lib\/couchbase\/logs\r\n\r\n\r\n#List cluster\r\ncouchbase-cli server-list -c 192.168.56.74:8091 --username Administrator \\\r\n--password password\r\n\r\n<\/pre>\n<pre><\/pre>\n<pre>#Couchbase terminal\r\ncd \/opt\/couchbase\/bin \r\n.\/cbq -u Administrator -p password -engine=http:\/\/192.168.56.74:8091\/\r\n\r\n\r\n\r\n<\/pre>\n<p>#Dba queries SELECT * FROM system:keyspaces; select active_requests.* from system:active_requests; select * from system:completed_requests; SELECT * FROM system:my_user_info; SELECT * FROM system:user_info; SELECT * FROM system:nodes; SELECT * FROM system:functions; SELECT * FROM system:functions_cache;<\/p>\n<p>#Audit&#8217;s effect on performance<\/p>\n<p>Audit is closed with all futures . Stress test :<br \/>\n1000000 row , 10 min, 1.2gb. Bucket has 2 replica. 20persec.<\/p>\n<p>Audit is opened with all futures . Stress test :<br \/>\n1000000 row , 10 min, 1.2gb. Bucket has 2 replica. 20persec.\u00a0 Audit file size = 256kb.<\/p>\n<pre>#Sample queries\r\nSELECT callsign FROM `travel-sample` LIMIT 5;\r\nSELECT * FROM `travel-sample` WHERE type=\"airport\" LIMIT 1;\r\nSELECT name FROM `travel-sample` WHERE type=\"hotel\" AND city=\"Medway\" and pets_ok=true LIMIT 10;\r\nSELECT name,phone FROM `travel-sample` WHERE type=\"hotel\" AND city=\"Manchester\" and directions IS NOT MISSING ORDER BY name LIMIT 10;<\/pre>\n<pre>#perf metric data\r\ncbstats 192.168.56.74:11210 -j -u Administrator -p password -b travel-data all\r\n\r\n\r\n<\/pre>\n<pre>#Rebalance status with http protocol as rest api\r\ncurl --silent -u Administrator:password 192.168.56.74:8091\/pools\/default\/tasks | python -mjson.tool | grep -A1 -B4 rebalance<\/pre>\n<pre>#Stats on web interface\r\nhttp:\/\/192.168.56.74:8091\/pools\/default\/buckets\/travel-data\/stats\r\n\r\n\r\n<\/pre>\n<p>#Data load for stress test<\/p>\n<pre>cbworkloadgen -n 192.168.56.74:8091 \\\r\n-n 192.168.56.74:8091 \\\r\n-u Administrator -p password \\\r\n-r .9 -i 1000000 -j \\\r\n-s 100 \\\r\n-b travel-data \\\r\n-t 10\r\n\r\n\r\n<\/pre>\n<pre>#Cluster server list\r\ncouchbase-cli server-list -c 192.168.56.74:8091 --username Administrator --password password\r\ncurl -u Administrator:password -v -X GET http:\/\/192.168.56.74:8091\/pools\/default | jq '.' | grep hostname\r\n\r\n\r\n<\/pre>\n<pre>#Session time out set\r\ncurl -X POST -u Administrator:password \\\r\nhttp:\/\/192.168.56.74:8091\/settings\/security \\\r\n-d \"uiSessionTimeout=600\"\r\n\r\n<\/pre>\n<pre>#Stats\r\ncbstats -b travel-data -u Administrator -p password \\\r\n192.168.56.74:11210 vbucket | grep 1014\r\n\r\n\r\nThanks<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Why Couchbase? Today\u2019s mission-critical applications demand support for millions of interactions with end-users. Traditional databases were built for thousands. Designed for consistency and control, they lack agility, flexibility, and scalability. To execute multiple use cases, organizations are forced to deploy multiple types of databases, resulting in a &#8220;database sprawl&#8221; &#8211; and inefficiency, sluggish time to &hellip;<\/p>\n","protected":false},"author":10449,"featured_media":14036,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[7687,6798,23],"tags":[7681,7682,7684,7683,7685,7686,7679,7680],"class_list":["post-14035","post","type-post","status-publish","format-standard","has-post-thumbnail","","category-couchbase","category-nosql","category-veritabani","tag-bucket","tag-cbbackup","tag-cbq","tag-cbrestore","tag-cbstats","tag-cbworkloadgen","tag-couchbase","tag-couchbase-cli"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/ittutorial.org\/wp-content\/uploads\/2020\/03\/couchbase.png","jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/14035","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/users\/10449"}],"replies":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/comments?post=14035"}],"version-history":[{"count":9,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/14035\/revisions"}],"predecessor-version":[{"id":24500,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/14035\/revisions\/24500"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media\/14036"}],"wp:attachment":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media?parent=14035"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/categories?post=14035"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/tags?post=14035"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}