CentOS6 mininal 安装CouchDB2 详细版

CentOS6 mininal 安装CouchDB2 详细版

couchdb官网:http://couchdb.apache.org/

安装依赖

-Erlang OTP (>=R61B03, =<19.x)-ICU-OpenSSL-Mozilla SpiderMonkey (1.8.5)-GNU Make-GNU Compiler Collection-libcurl-help2man-Python (>=2.7)fordocs-Python Sphinx (>=1.1.3)

参考教程:http://docs.couchdb.org/en/2.0.0/install/unix.html

# 初始设置,避免不必要的权限问题/etc/init.d/iptablesstopsetenforce0sed -i's/SELINUX=enforcing/SELINUX=disabled/g'/etc/selinux/config# 安装依赖yum -yupdateyum -ygroupinstall"Development Tools""Development Libraries"rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpmyum install autoconf automake curl-devel help2man libicu-devel libtoolperl-Test-Harness wget libicu-devel curl-devel ncurses-devel libtool libxslt fop java-1.7.0-openjdk java-1.7.0-openjdk-devel unixODBC unixODBC-develvimopenssl-devel

源码安装erlang

yum install erlang-asn1 erlang-erts erlang-eunit erlang erlang-os_mon erlang-xmerlwget http://erlang.org/download/otp_src_19.3.tar.gz  #满足依赖的最新版erlangtar -xvf otp_src_19.3.tar.gzcd otp_src_19.3./configure && makemake install

源码安装 js-devel

js-devel-1.8.5 # 无yum安装包

wget http://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gzcdjs-1.8.5/js/src./configure && makesudo make install

安装autoconf-archive

配置puias-computational.repo 安装autoconf-arch

vim /etc/yum.repos.d/puias-computational.repo[PUIAS_6_computational]name=PUIAS computational Base$releasever-$basearchmirrorlist=http://puias.math.ias.edu/data/puias/computational/$releasever/$basearch/mirrorlistgpgcheck=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puiasInstall autoconf-archive rpm package:yum install autoconf-archive -y

源码安装CouchDB

wget http://mirror.bit.edu.cn/apache/couchdb/source/2.0.0/apache-couchdb-2.0.0.tar.gztar zxvf apache-couchdb-2.0.0.tar.gzcdapache-couchdb-2.0.0./configuremakerelease  # 这里有报错,根据解决方法修改完成之后重新makerelease,在文章末尾

添加用户启动couchdb

# groupadd CouchDB Administrator# adduser --system --no-create-home --shell /bin/bash --group --gecos "CouchDB Administrator" couchdb  # 默认CouchDB Administrator不存在,官网命令有点坑# - adduser: group '--gecos' does not existadduser --system--no-create-home --shell /bin/bash -c"CouchDB Administrator"couchdb# 使用此条命令mv /usr/local/src/apache-couchdb-2.0.0/rel/couchdb /usr/local/chown-R couchdb:couchdb /usr/local/couchdb# find /usr/local/couchdb -type d -exec chmod 0770 {} \;# chmod 0644 /usr/local/couchdb/etc/*

配置couchdb,特别重要

vim /usr/local/couchdb/etc/vm.args-name couchdb@n1couchdb.aniu.so> 注意:前提时设置系统需要设置hostname,修改完成系统hosts文件为0.0.0.0localhost localhost.localdomain n1couchdb.aniu.so#0.0.0.0localhost localhost.localdomain n1couchdb.aniu.so192.168.0.154n1couchdb.aniu.sohostname n1couchdb.aniu.sosed -i 's/localhost.localdomain/n1couchdb.aniu.so/g' /etc/sysconfig/network> 上面几步操作是修改hostname,方便识别,为后面配置couchdb集群方便# -kernel inet_dist_listen_min9100# -kernel inet_dist_listen_max9200> 上面两个参数暂时不用,配置集群的时候在使用# 修改couchdb启动时默认监听的ip,默认127.0.0.1,不能通过浏览器进行初始化设置,改为0.0.0.0sed -i 's/127.0.0.1/0.0.0.0/g' /usr/local/couchdb/etc/default.ini

配置完成之后使用couchdb用户启动couchdb

su- couchdbcd/usr/local/couchdb./bin/couchdb

启动成功界面如下:

[info]2017-07-04T13:09:39.587046Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application couch_log startedonnode'couchdb@n1couchdb.aniu.so'[info]2017-07-04T13:09:39.593768Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application folsom startedonnode'couchdb@n1couchdb.aniu.so'[info]2017-07-04T13:09:39.649564Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application couch_stats startedonnode'couchdb@n1couchdb.aniu.so'[info]2017-07-04T13:09:39.649666Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application khash startedonnode'couchdb@n1couchdb.aniu.so'[info]2017-07-04T13:09:39.662118Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application couch_event startedonnode'couchdb@n1couchdb.aniu.so'[info]2017-07-04T13:09:39.670377Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application ibrowse startedonnode'couchdb@n1couchdb.aniu.so'[info]2017-07-04T13:09:39.678054Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application ioq startedonnode'couchdb@n1couchdb.aniu.so'[info]2017-07-04T13:09:39.678117Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application mochiweb startedonnode'couchdb@n1couchdb.aniu.so'[info]2017-07-04T13:09:39.678238Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application oauth startedonnode'couchdb@n1couchdb.aniu.so'[info]2017-07-04T13:09:39.689266Z couchdb@n1couchdb.aniu.so<0.210.0> -------- Apache CouchDB2.0.0isstarting.[info]2017-07-04T13:09:39.689396Z couchdb@n1couchdb.aniu.so<0.211.0> -------- Starting couch_sup[info]2017-07-04T13:09:39.937994Z couchdb@n1couchdb.aniu.so<0.210.0> -------- Apache CouchDBhasstarted. Timetorelax.[info]2017-07-04T13:09:39.938230Z couchdb@n1couchdb.aniu.so<0.210.0> -------- Apache CouchDBhasstartedonhttp://0.0.0.0:5986/[info]2017-07-04T13:09:39.938366Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application couch startedonnode'couchdb@n1couchdb.aniu.so'[info]2017-07-04T13:09:39.938520Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application ets_lru startedonnode'couchdb@n1couchdb.aniu.so'[info]2017-07-04T13:09:39.953625Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application rexi startedonnode'couchdb@n1couchdb.aniu.so'[error]2017-07-04T13:09:40.065167Z couchdb@n1couchdb.aniu.so<0.293.0> -------- ** System runningtouse fully qualified hostnames **** Hostname localhostisillegal **[info]2017-07-04T13:09:40.099794Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application mem3 startedonnode'couchdb@n1couchdb.aniu.so'[info]2017-07-04T13:09:40.099886Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application fabric startedonnode'couchdb@n1couchdb.aniu.so'[info]2017-07-04T13:09:40.126321Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application chttpd startedonnode'couchdb@n1couchdb.aniu.so'[notice]2017-07-04T13:09:40.145151Z couchdb@n1couchdb.aniu.so<0.328.0> -------- chttpd_auth_cachechangeslistener died database_does_not_exist at mem3_shards:load_shards_from_db/6(line:327) <= mem3_shards:load_shards_from_disk/1(line:315) <= mem3_shards:load_shards_from_disk/2(line:331) <= mem3_shards:for_docid/3(line:87) <= fabric_doc_open:go/3(line:38) <= chttpd_auth_cache:ensure_auth_ddoc_exists/2(line:187) <= chttpd_auth_cache:listen_for_changes/1(line:134)[error]2017-07-04T13:09:40.145263Z couchdb@n1couchdb.aniu.soemulator -------- Error in process <0.329.0>onnode'couchdb@n1couchdb.aniu.so'withexitvalue:{database_does_not_exist,[{mem3_shards,load_shards_from_db,"_users",[{file,"src/mem3_shards.erl"},{line,327}]},{mem3_shards,load_shards_from_disk,1,[{file,"src/mem3_shards.erl"},{line,315}]},{mem3_shards,load_shards_from_disk,2,[{file,"src/mem3_shards.erl"},{line,331}]},{mem3_shards,for_docid,3,[{file,"src/mem3_shards.erl"},{line,87}]},{fabric_doc_open,go,3,[{file,"src/fabric_doc_open.erl"},{line,38}]},{chttpd_auth_cache,ensure_auth_ddoc_exists,2,[{file,"src/chttpd_auth_cache.erl"},{line,187}]},{chttpd_auth_cache,listen_for_changes,1,[{file,"src/chttpd_auth_cache.erl"},{line,134}]}]}[info]2017-07-04T13:09:40.151849Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application couch_index startedonnode'couchdb@n1couchdb.aniu.so'[info]2017-07-04T13:09:40.151985Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application couch_mrview startedonnode'couchdb@n1couchdb.aniu.so'[info]2017-07-04T13:09:40.152078Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application couch_plugins startedonnode'couchdb@n1couchdb.aniu.so'[info]2017-07-04T13:09:40.193218Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application couch_replicator startedonnode'couchdb@n1couchdb.aniu.so'[info]2017-07-04T13:09:40.193271Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application couch_peruser startedonnode'couchdb@n1couchdb.aniu.so'[info]2017-07-04T13:09:40.205124Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application ddoc_cache startedonnode'couchdb@n1couchdb.aniu.so'[info]2017-07-04T13:09:40.225182Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application global_changes startedonnode'couchdb@n1couchdb.aniu.so'[info]2017-07-04T13:09:40.225319Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application jiffy startedonnode'couchdb@n1couchdb.aniu.so'[info]2017-07-04T13:09:40.233555Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application mango startedonnode'couchdb@n1couchdb.aniu.so'[info]2017-07-04T13:09:40.241861Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application setup startedonnode'couchdb@n1couchdb.aniu.so'[info]2017-07-04T13:09:40.241950Z couchdb@n1couchdb.aniu.so<0.9.0> -------- Application snappy startedonnode'couchdb@n1couchdb.aniu.so'[notice]2017-07-04T13:09:45.145647Z couchdb@n1couchdb.aniu.so<0.328.0> -------- chttpd_auth_cachechangeslistener died database_does_not_exist at mem3_shards:load_shards_from_db/6(line:327) <= mem3_shards:load_shards_from_disk/1(line:315) <= mem3_shards:load_shards_from_disk/2(line:331) <= mem3_shards:for_docid/3(line:87) <= fabric_doc_open:go/3(line:38) <= chttpd_auth_cache:ensure_auth_ddoc_exists/2(line:187) <= chttpd_auth_cache:listen_for_changes/1(line:134)[error]2017-07-04T13:09:45.145807Z couchdb@n1couchdb.aniu.soemulator -------- Error in process <0.455.0>onnode'couchdb@n1couchdb.aniu.so'withexitvalue:{database_does_not_exist,[{mem3_shards,load_shards_from_db,"_users",[{file,"src/mem3_shards.erl"},{line,327}]},{mem3_shards,load_shards_from_disk,1,[{file,"src/mem3_shards.erl"},{line,315}]},{mem3_shards,load_shards_from_disk,2,[{file,"src/mem3_shards.erl"},{line,331}]},{mem3_shards,for_docid,3,[{file,"src/mem3_shards.erl"},{line,87}]},{fabric_doc_open,go,3,[{file,"src/fabric_doc_open.erl"},{line,38}]},{chttpd_auth_cache,ensure_auth_ddoc_exists,2,[{file,"src/chttpd_auth_cache.erl"},{line,187}]},{chttpd_auth_cache,listen_for_changes,1,[{file,"src/chttpd_auth_cache.erl"},{line,134}]}]}

查看couchdb进程

[root@n1couchdb ~]# ps -ef | grep couchdbcouchdb35821020:59 ?        00:00:00 /usr/local/couchdb/bin/../erts-8.3/bin/epmd -daemonroot38043789021:06 pts/2    00:00:00 su - couchdbcouchdb38053804021:06 pts/2    00:00:00 -bashcouchdb39013805321:09 pts/2    00:00:04 /usr/local/couchdb/bin/../erts-8.3/bin/beam.smp -K true -A16-Bd -- -root /usr/local/couchdb/bin/.. -progname couchdb -- -home /home/couchdb -- -boot /usr/local/couchdb/bin/../releases/2.0.0/couchdb -name couchdb@n1couchdb.aniu.so -setcookie monster -kernel error_logger silent -sasl sasl_error_logger false -noshell -noinput -kernel inet_dist_listen_min9100-kernel inet_dist_listen_max9200-config /usr/local/couchdb/bin/../releases/2.0.0/sys.configcouchdb39283901021:09 ?        00:00:00 erl_child_setup 1024couchdb39343928021:09 ?        00:00:00 sh -s disksupcouchdb39363928021:09 ?        00:00:00 /usr/local/couchdb/bin/../lib/os_mon-2.4.2/priv/bin/memsupcouchdb39373928021:09 ?        00:00:00 /usr/local/couchdb/bin/../lib/os_mon-2.4.2/priv/bin/cpu_supcouchdb39383928021:09 ?        00:00:00 inet_gethost 4couchdb39393938021:09 ?        00:00:00 inet_gethost 4root39613945021:12 pts/3    00:00:00 grep couchdb[root@n1couchdb ~]# netstat -nlptActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address              Foreign Address            State      PID/Program nametcp000.0.0.0:5984                0.0.0.0:*                  LISTEN      4355/beam.smptcp000.0.0.0:5986                0.0.0.0:*                  LISTEN      4355/beam.smptcp000.0.0.0:4369                0.0.0.0:*                  LISTEN      3582/epmd

检查couchdb是否正常工作

[root@n1couchdb ~]# curl -I http://0.0.0.0:5984/_utils/index.htmlHTTP/1.1 200 OKCache-Control: private, must-revalidateContent-Length: 1886Content-Security-Policy:default-src'self';img-src'self'data:;font-src'self';script-src'self''unsafe-eval';style-src'self''unsafe-inline';Content-Type: text/htmlDate: Tue, 04 Jul 2017 13:26:40 GMTlast-modified: Tue, 04 Jul 2017 12:43:17 GMTServer: CouchDB/2.0.0 (Erlang OTP/19)

单点情况下通过浏览器访问

http://192.168.0.154:5984/_utils/#verifyinstall,进行初始化设置,如下图:

这里初始设置 username: admin password: password ,方便记忆,后面需要再改

登录成功,配置单节点

CouchDB管理页面还有许多操作,这里就不过多演示

安装过程中报错修复

ERROR: compile failed while processing /usr/local/src/apache-couchdb-2.0.0/src/couch: rebar_abort

解决报错:

cd/usr/local/src/apache-couchdb-2.0.0egrep -r js-1.8.5*vim +106src/couch/rebar.config.script{"linux",  CouchJSPath, CouchJSSrc, [{env, [{"CFLAGS", JS_CFLAGS ++" -DXP_UNIX -I/usr/include/js"}, {"LDFLAGS", JS_LDFLAGS ++" -lm"}]}]},改为:{"linux",  CouchJSPath, CouchJSSrc, [{env, [{"CFLAGS", JS_CFLAGS ++" -DXP_UNIX -I/usr/local/include/js"}, {"LDFLAGS", JS_LDFLAGS ++" -lm"}]}]},# 根本原因就是couchdb编译的时候找到默认的js# 还有种方式就是做软链接ln -s/usr/local/include/js/usr/include/j# 这种方法尚未尝试,修改完成就可以继续编译啦

安装依赖缺失报错

[root@localhost apache-couchdb-2.0.0]# make releaseUncaughterrorinrebar_core: {'EXIT',                              {undef,                                [{crypto,start,[],[]},                                {rebar,run_aux,2,                                  [{file,"src/rebar.erl"},{line,212}]},                                {rebar,main,1,                                  [{file,"src/rebar.erl"},{line,58}]},                                {escript,run,2,                                  [{file,"escript.erl"},{line,760}]},                                {escript,start,1,                                  [{file,"escript.erl"},{line,277}]},                                {init,start_em,1,[]},                                {init,do_boot,3,[]}]}}make: *** [couch]Error1

次报错是编译erlang前没安装openssl-devel,安装openssl-devel重新编译erlang

安装完成

WARN:'generate'commanddoesnotapplytodirectory/usr/local/src/apache-couchdb-2.0.0... done    You can now copytherel/couchdbdirectoryanywhereonyoursystem.    Start CouchDBwith./bin/couchdbfromwithinthatdirectory.

下面是程序本身BUG

[notice]2017-07-04T13:18:55.255565Z couchdb@n1couchdb.aniu.so<0.328.0> -------- chttpd_auth_cachechangeslistener died database_does_not_exist at mem3_shards:load_shards_from_db/6(line:327) <= mem3_shards:load_shards_from_disk/1(line:315) <= mem3_shards:load_shards_from_disk/2(line:331) <= mem3_shards:for_docid/3(line:87) <= fabric_doc_open:go/3(line:38) <= chttpd_auth_cache:ensure_auth_ddoc_exists/2(line:187) <= chttpd_auth_cache:listen_for_changes/1(line:134)[error]2017-07-04T13:18:55.255823Z couchdb@n1couchdb.aniu.soemulator -------- Error in process <0.9372.0>onnode'couchdb@n1couchdb.aniu.so'withexitvalue:{database_does_not_exist,[{mem3_shards,load_shards_from_db,"_users",[{file,"src/mem3_shards.erl"},{line,327}]},{mem3_shards,load_shards_from_disk,1,[{file,"src/mem3_shards.erl"},{line,315}]},{mem3_shards,load_shards_from_disk,2,[{file,"src/mem3_shards.erl"},{line,331}]},{mem3_shards,for_docid,3,[{file,"src/mem3_shards.erl"},{line,87}]},{fabric_doc_open,go,3,[{file,"src/fabric_doc_open.erl"},{line,38}]},{chttpd_auth_cache,ensure_auth_ddoc_exists,2,[{file,"src/chttpd_auth_cache.erl"},{line,187}]},{chttpd_auth_cache,listen_for_changes,1,[{file,"src/chttpd_auth_cache.erl"},{line,134}]}]}

作为单个节点运行2.0时,它不会在启动时创建系统数据库,必须手动执行此操作:

curl -XPUThttp://0.0.0.0:5984/_userscurl -XPUThttp://0.0.0.0:5984/_replicatorcurl -XPUThttp://0.0.0.0:5984/_global_changes

参考教程

http://guide.couchdb.org/draft/security.html

http://docs.couchdb.org/en/latest/install/setup.html

https://medium.com/linagora-engineering/setting-up-a-couchdb-2-cluster-on-centos-7-8cbf32ae619f

http://docs.couchdb.org/en/2.0.0/install/unix.html

https://issues.apache.org/jira/browse/COUCHDB-2995# 最重要报错修复

http://docs.couchdb.org/en/2.0.0/cluster/setup.html#the-cluster-setup-wizard

原文链接

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 212,080评论 6 493
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 90,422评论 3 385
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 157,630评论 0 348
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 56,554评论 1 284
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 65,662评论 6 386
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,856评论 1 290
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,014评论 3 408
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,752评论 0 268
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,212评论 1 303
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,541评论 2 327
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,687评论 1 341
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,347评论 4 331
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,973评论 3 315
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,777评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,006评论 1 266
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,406评论 2 360
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,576评论 2 349

推荐阅读更多精彩内容