couchbase网上资源比较少,尤其是默认端口的修改,特意在这里总结一下
Couchbase 是一个开源的、分布式的、面向文档(document-oriented)的 NoSQL 数据库,并且内置了 Memcached 服务。本文分享的是自己在 Linux 上成功安装 Couchbase Server 的实际操作步骤。
Linux 发行版是 CentOS。
1. 下载 Couchbase 安装包
用 wget 命令进行下载:下载地址:http://www.couchbase.com/
wget http://packages.couchbase.com/releases/2.0.0/couchbase-server-enterprise_x86_64_2.0.0.rpm
2. 用 rpm 命令进行安装 Couchbase
rpm --install couchbase-server-enterprise_x86_64_2.0.0.rpm
重安装命令:rpm -iv --replacepkgs couchbase-server-enterprise_x86_64_2.0.0.rpm
命令运行之后出错:
error: Failed dependencies:
libcrypto.so.6()(64bit) is needed by couchbase-server-2.0.0-1976.x86_64
libssl.so.6()(64bit) is needed by couchbase-server-2.0.0-1976.x86_64
3. 安装 openssl
根据第 2 步中的错误,寻找包含 libcrypto.so.6 的安装包,运行下面的命令:
yum provides */libcrypto.so.6
发现 openssl098e-0.9.8e-17.el6.centos.2.x86_64
安装该版本的 opensll 包:
yum install openssl098e-0.9.8e-17.el6.centos.2.x86_64
4. 重新安装 Couchbase
rpm --install couchbase-server-enterprise_x86_64_2.0.0.rpm
安装成功!显示下面的信息:
Starting couchbase-server[ OK ]
You have successfully installed Couchbase Server.
Please browse to http://cache:8091/ to configure your server.
Please refer to http://couchbase.com for additional resources.
Please note that you have to update your firewall configuration to
allow connections to the following ports: 11211, 11210, 11209, 4369,
8091 and from 21100 to 21299.
By using this software you agree to the End User License Agreement.
See /opt/couchbase/LICENSE.txt.
然后通过浏览器访问 http://ip:8091 进行相关配置。
【注】安装Couchbase的文件夹要进行这样的授权设置:chown -R couchbase:couchbase .
二、couchbase启动停止命令
/opt/couchbase/etc/couchbase_init.d stop
/opt/couchbase/etc/couchbase_init.d status
/opt/couchbase/etc/couchbase_init.d start
对于开发和测试环境,也可以通过配置让Couchbase Server监听用户自定义端口。需要注意的是,如果你想通过自定义端口的方法在一个服务器上部署多个Couchbase Server,标准的RPM安装方式是不允许你为不同实例指定不同的安装路径的,因此你需要使用多个non-root的安装命令。下面对自定义端口的步骤简单介绍:
安装Couchbase Server|
·如果Couchbase Server已经安装成功,执行stop命令
在文件/opt/couchbase/etc/couchbase/static_config中添加新的用户自定义端口
/opt/couchbase/etc/couchbase/static_config是Couchbase Server读取配置参数的位置。·如果没有明确指定端口,默认配置就会启用。·在文件中追加用户自定义端口信息,可以部分或全部覆盖默认配置信息。
CAPI端口(默认8092)可以在文件/opt/couchbase/etc/couchdb/default.d/capi.ini中修改
如果要废弃现有Couchbase Server的自定义配置,删除文件opt/couchbase/var/lib/couchbase/config/config.dat即可
启动Couchbase Server
/opt/couchbase/etc/couchbase/static_config的配置样例以及与默认端口的对应关系如下:
注:如果配置的端口被其他应用占用,Couchbase Server会启动失败。如果需要在同一服务器上部署多个实例,这些服务端口需要各不相同。