一、CouchDB简介
CouchDB是Apache Foundation开发的免费开源NoSQL数据库。该特定数据库侧重于易用性和可伸缩性。CouchDB具有面向文档的NoSQL数据库体系结构,使用JSON存储数据,它使用Javascript作为其查询语言,使用HTTP作为其API。
CouchDB与关系数据库不同,因为每个数据库都是独立文档的集合,每个文档都维护着自己的数据和自包含模式。由于其出色的复制和同步功能,CouchDB为移动设备应用和类似的基于服务的需求提供了理想的数据库。此NoSQL数据库也非常适合具有累积数据(版本控制是关键)的应用程序,例如CRM和CMS系统。
二、安装epel-release存储库
CouchDB存储库取决于EPEL存储库](https://myfreax.com/post/how-to-enable-epel-repository-on-centos/)。安装epel-release存储库
[root@localhost hl95_network]# yum install epel-release -y
三、创建CouchDB存储库文件
[root@localhost hl95_network]# vim /etc/yum.repos.d/apache-couchdb.repo
[bintray--apache-couchdb-rpm] name=bintray--apache-couchdb-rpm baseurl=http://apache.bintray.com/couchdb-rpm/el$releasever/$basearch/ gpgcheck=0 repo_gpgcheck=0 enabled=1
四、安装CouchDB
[root@localhost opt]# yum install couchdb -y
安装路径为/opt/couchdb
[root@localhost opt]# ll /opt/couchdb/ ??? 108 drwxr-xr-x 2 couchdb couchdb 68 7? 21 16:04 bin lrwxrwxrwx 1 couchdb couchdb 16 7? 21 16:04 data -> /var/lib/couchdb drwxr-xr-x 8 couchdb couchdb 76 7? 21 16:04 erts-9.3.3.14 drwxr-xr-x 4 couchdb couchdb 89 7? 21 16:04 etc drwxr-xr-x 49 couchdb couchdb 4096 7? 21 16:04 lib -rwxr-xr-x 1 couchdb couchdb 104255 5? 4 10:16 LICENSE drwxr-xr-x 3 couchdb couchdb 57 7? 21 16:04 releases drwxr-xr-x 5 couchdb couchdb 43 7? 21 16:04 share drwxr-xr-x 3 couchdb couchdb 17 7? 21 16:04 var [root@localhost opt]#
五、启动couchdb
[root@localhost opt]# systemctl enable couchdb Created symlink from /etc/systemd/system/multi-user.target.wants/couchdb.service to /usr/lib/systemd/system/couchdb.service. [root@localhost opt]#
[root@localhost opt]# systemctl start couchdb [root@localhost opt]# systemctl status couchdb ? couchdb.service - Apache CouchDB Loaded: loaded (/usr/lib/systemd/system/couchdb.service; disabled; vendor preset: disabled) Active: activating (auto-restart) (Result: exit-code) since ? 2020-07-21 16:06:28 CST; 34ms ago Process: 12047 ExecStart=/opt/couchdb/bin/couchdb (code=exited, status=1/FAILURE) Main PID: 12047 (code=exited, status=1/FAILURE) 7? 21 16:06:28 localhost systemd[1]: Unit couchdb.service entered failed state. 7? 21 16:06:28 localhost systemd[1]: couchdb.service failed. [root@localhost opt]#
六、停止couchdb
[root@localhost opt]# systemctl stop couchdb
七、配置CouchDB
修改监听地址和端口
[root@localhost opt]# vim /opt/couchdb/etc/local.ini
查找[chttpd]部分
[chttpd] ;port = 5984 ;bind_address = 127.0.0.1 bind_address=0.0.0.0
监听地址改为:0.0.0.0
设置数据目录
查找[couchdb]部分
[couchdb] ;max_document_size = 4294967296 ; bytes ;os_process_timeout = 5000 uuid = 0446409388bdbdc5436c7fa4f6491afe database_dir=/home/couchdb
添加database_dir项
查找[admins]部分
设置管理员登录密码
[admins] ;admin = mysecretpassword admin=xxxxxxx
八、重启CouchDB
[root@localhost opt]# systemctl restart couchdb [root@localhost opt]# netstat -tunlp|grep 5984 tcp 0 0 0.0.0.0:5984 0.0.0.0:* LISTEN 13359/beam.smp
九、测试
[root@localhost opt]# curl http://127.0.0.1:5984 {"couchdb":"Welcome","version":"3.1.0","git_sha":"ff0feea20","uuid":"5efbd66f2f7a3cb2eaf3b306ce87c7fa","features":["access-ready","partitioned","pluggable-storage-engines","reshard","scheduler"],"vendor":{"name":"The Apache Software Foundation"}}
十、登录管理后台
http://xxx.xxx.xxx.xxx:5984/_utils