Usefull Scripts For Couchbase Dba

Why Couchbase?

Today’s 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 “database sprawl” – and inefficiency, sluggish time to market, and poor customer experience. Traditional transactional and analytical databases predate today’s cloud-everywhere reality. A cloud-native data management platform offers you a real competitive edge.

Enterprises are realizing that the requirements for extraordinary customer engagement can’t 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.

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.

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:

  • Unified Programming Interface
  • Query
  • Search
  • Mobile and IoT
  • Analytics
  • Core database engine
  • Scale-out architecture
  • Memory-first architecture
  • Big data and SQL integrations
  • Full-stack security
  • Container and Cloud deployments
  • High Availability

 

Couchbase scripts for dbas

Couchbase is also faster in reading and writing than other open source databases.

Upgrade is zero downtime.

Doc for Couchbase

 

 

https://docs.couchbase.com/server/6.5/getting-started/start-here.html

 

Video education for Couchbase

https://learn.couchbase.com/store

 

Enterprise and Comminity differences

https://www.couchbase.com/products/editions

 

 

export JAVA_HOME=/usr/java/jre1.8.0_241-amd64
export PATH=$PATH:$JAVA_HOME/bin
export CAUCHBASE_HOME=/opt/couchbase
export PATH=$PATH:$CAUCHBASE_HOME/bin
export LD_LIBRARY_PATH=/opt/couchbase/lib
export CLASSPATH=$CLASSPATH:/opt/couchbase/lib/*
export PYTHONPATH=/opt/couchbase/lib/python
#Install cauchbase
wget https://packages.couchbase.com/releases/6.0.0/couchbase-server-community-6.0.0-centos7.x86_64.rpm
rpm -ivh couchbase-server-community-6.0.0-centos7.x86_64.rpm



#Start couchbase
systemctl enable couchbase-server
systemctl start couchbase-server
systemctl status couchbase-server


#bucket-create
couchbase-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
#backup
mkdir -p /tmp/cbbackup/
cd /opt/couchbase/bin
cbbackup http://192.168.56.74:8091 /tmp/cbbackup/ -u Administrator -p password

#restore
cbrestore /tmp/cbbackup http://192.168.56.74:8091 -u Administrator -p password --bucket-source=travel-data --bucket-destination=travel-data
#Audit setting
couchbase-cli setting-audit -c 192.168.56.74:8091 --username Administrator \
--password password --audit-enabled 1 --audit-log-rotate-interval 604800 \
--audit-log-path /opt/couchbase/var/lib/couchbase/logs


#List cluster
couchbase-cli server-list -c 192.168.56.74:8091 --username Administrator \
--password password

#Couchbase terminal
cd /opt/couchbase/bin 
./cbq -u Administrator -p password -engine=http://192.168.56.74:8091/



#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;

#Audit’s effect on performance

Audit is closed with all futures . Stress test :
1000000 row , 10 min, 1.2gb. Bucket has 2 replica. 20persec.

Audit is opened with all futures . Stress test :
1000000 row , 10 min, 1.2gb. Bucket has 2 replica. 20persec.  Audit file size = 256kb.

#Sample queries
SELECT callsign FROM `travel-sample` LIMIT 5;
SELECT * FROM `travel-sample` WHERE type="airport" LIMIT 1;
SELECT name FROM `travel-sample` WHERE type="hotel" AND city="Medway" and pets_ok=true LIMIT 10;
SELECT name,phone FROM `travel-sample` WHERE type="hotel" AND city="Manchester" and directions IS NOT MISSING ORDER BY name LIMIT 10;
#perf metric data
cbstats 192.168.56.74:11210 -j -u Administrator -p password -b travel-data all


#Rebalance status with http protocol as rest api
curl --silent -u Administrator:password 192.168.56.74:8091/pools/default/tasks | python -mjson.tool | grep -A1 -B4 rebalance
#Stats on web interface
http://192.168.56.74:8091/pools/default/buckets/travel-data/stats


#Data load for stress test

cbworkloadgen -n 192.168.56.74:8091 \
-n 192.168.56.74:8091 \
-u Administrator -p password \
-r .9 -i 1000000 -j \
-s 100 \
-b travel-data \
-t 10


#Cluster server list
couchbase-cli server-list -c 192.168.56.74:8091 --username Administrator --password password
curl -u Administrator:password -v -X GET http://192.168.56.74:8091/pools/default | jq '.' | grep hostname


#Session time out set
curl -X POST -u Administrator:password \
http://192.168.56.74:8091/settings/security \
-d "uiSessionTimeout=600"

#Stats
cbstats -b travel-data -u Administrator -p password \
192.168.56.74:11210 vbucket | grep 1014


Thanks

 23,084 views last month,  31 views today

About Fatih Gençali

- I have supported as Oracle Dba for more than 6.5 years. - I worked in 24x7 production and test environment. - I have 12C OCP certificate. - I have europass diploma supplement. - Saving operations - I have supported databases that are telecommunication , banking, insurance, financial, retail and manufacturing, marketing, e-invoicing . - Providing aligment between prod , prp , stb , dev - Providing management and performance tuning for app and database machines (linux) - Performance tuning and sql tuning - Consolidations, Migration (expdp,xtts,switchover vb...) , installation, patch , upgrade , dataguard , shell script writing , backup restore , exadata management , performans management , security management ,goldengate operations - Resolving performance and security problems for databases and linux machines - I managed oracle 10g/11g/12c databases (dev/test/prp/snap/prod/stby) on Linux/HP/AIX/Solaris O.S - Pl/sql operations , supported shell script, (for aligments and others) - Providing highly available it (software-hardware) systems, especially database systems. - Managing and monitoring availabilities and operations of all systems . - Goldengate operations (oracle to oracle , oracle to bigdata (hdfs , kafka)) - Exadata operations (cell management,upgrade,switchover) - My work processes is according to itil. - Preparing automation for everything to reduce human resource requirement and routine works.

Leave a Reply

Do NOT follow this link or you will be banned from the site!