Couchbase是一个强大的、可靠的NoSql数据库.
Couchbase是CouchDB和MemBase的合并。而MemBase是基于Memcached的。因此Couchbase联合了CouchDB的简单可靠和Memcached的高性能和可扩展性.
[X] 安装
[1] 设置/etc/selinux/config
文件中的SELINUX=""
为disabled
[2] vi/etc/modprobe.d/blacklist.conf
blacklist ipv6
setenforce 0
swapoff -a
chkconfig ip6tables off
chkconfig iptables off
service ip6tables stop
service iptables stop
[3] vi/etc/rc.d/rc.local
#wjw_add
su root -lc 'swapoff -a'
[4] vi /etc/sysctl.conf
#wjw_add
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
kernel.pid_max = 65536
fs.aio-max-nr = 1048576
fs.file-max = 6815744
net.core.rmem_default = 16777216
net.core.rmem_max = 16777216
net.core.wmem_default = 16777216
net.core.wmem_max = 16777216
net.core.somaxconn = 262144
net.ipv4.tcp_no_metrics_save = 1
net.core.netdev_max_backlog = 262144
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 16384 16777216
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_congestion_control=cubic
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_retries2 = 5
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_max_orphans = 262144
net.ipv4.conf.lo.arp_ignore = 0
net.ipv4.conf.lo.arp_announce = 0
net.ipv4.conf.all.arp_ignore = 0
net.ipv4.conf.all.arp_announce = 0
net.nf_conntrack_max = 655360
net.netfilter.nf_conntrack_tcp_timeout_established = 180
net.core.rmem_max=16777216
net.core.wmem_max=16777216
net.ipv4.tcp_rmem=4096 87380 16777216
net.ipv4.tcp_wmem=4096 16384 16777216
net.ipv4.tcp_congestion_control=cubic
net.ipv6.conf.all.disable_ipv6=1
vm.swappiness=0
[5] 执行:sysctl -p
[6] vi/etc/security/limits.conf
* soft nproc 655350
* hard nproc 655350
* soft nofile 655350
* hard nofile 655350
[7] vi/etc/pam.d/login
session required /lib64/security/pam_limits.so
[8] 刷新缓存
swapoff -a
sync
echo 3 > /proc/sys/vm/drop_caches
[9] rpm couchbase
scp admin@192.168.2.113:/opt/install/couchbase-server-enterprise-3.0.2-centos6.x86_64.rpm /opt/
rpm -ivh /opt/couchbase-server-enterprise-3.0.2-centos6.x86_64.rpm
[X] 升级
[X] 通过SWAP的在线升级:
- 添加SWAP节点到集群,然后做
Rebalance
! - 通过
Fail Over
方式拿掉要升级的节点,然后做Rebalance
! - 执行:
service couchbase-server stop
当
service couchbase-server stop
不能停止时:
要使用:killall epmd
和killall beam.smp
后再用ps -ef | grep -i 'couchbase' | grep -v grep
查看是否还有/opt/couchbase
目录下的进程,如果有就kill
掉!
- rpm -ev $(rpm -qa | grep -i ‘couchbase’)
- rm -rf /opt/couchbase/*
- rpm -ivh ./couchbase-server-enterprise_2.5.1_x86_64.rpm
[X] 没有SWAP的快速在线升级:
- 关掉:
Auto-Failover
- service couchbase-server stop
- rpm -Uvh /opt/couchbase-server-enterprise-3.0.2-centos6.x86_64.rpm
附录:
[X] 当出现:runuser: command not found错误信息时,安装yum install coreutils
!
[X] 当service couchbase-server stop
不能停止时:
要使用:`killall epmd`和`killall beam.smp`后再用`ps -ef | grep -i 'couchbase' | grep -v grep`查看是否还有/opt/couchbase目录下的进程,如果有就kill掉!
[X] Couchbase相关指令
service couchbase-server stop
ps -ef | grep -i 'couchbase' | grep -v grep
rpm -qa | grep -i 'couchbase'
[X] 疑难问答
- How do I change the per-node RAM quota?
/opt/couchbase/bin/couchbase-cli cluster-init -c 192.168.1.41:8091 -u admin -p youyuan --cluster-init-ramsize=110000
- bucket-compact
/opt/couchbase/bin/couchbase-cli bucket-compact -c 192.168.1.71:8091 -u admin -p youyuan --bucket=default
- setting-compaction
/opt/couchbase/bin/couchbase-cli setting-compaction -c 192.168.1.71:8091 -u admin -p youyuan --compaction-period-from= --compaction-period-to=
- bucket-edit
/opt/couchbase/bin/couchbase-cli bucket-edit -c 192.168.1.71:8091 -u admin -p youyuan --bucket=default --compaction-period-from= --compaction-period-to=
- 备份
/opt/couchbase/bin/cbbackup -u admin -p youyuan -b conf http://${host}:8091 /opt/backups-couchbase/backup-conf
例如(备份指定的Bucket): /opt/couchbase/bin/cbbackup -u admin -p youyuan -b conf http://localhost:8091 /opt/backups-couchbase/backup-conf-20140415
- 恢复
/opt/couchbase/bin/cbrestore -u admin -p youyuan -b conf /opt/backups-couchbase/backup-conf http://${host}:8091
[X] 当集群出现大规模问题时,紧急处理步骤:
不要使用
service couchbase-server stop
,要使用:killall epmd
和killall beam.smp
后再用ps -ef | grep -i 'couchbase' | grep -v grep
查看是否还有/opt/couchbase
目录下的进程,如果有就kill
掉!