2

如何在CentOS 7安装CouchDB

 1 year ago
source link: https://www.myfreax.com/how-to-install-couchdb-on-centos-7/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

如何在CentOS 7安装CouchDB

Apache CouchDB是由Apache软件基金会开发的自由开源NoSQL数据库。它可以用作单节点数据库或集群数据库

Updated At 20 Oct 2022 3 min read
By myfreax
如何在CentOS 7安装CouchDB

如何在CentOS 7安装CouchDB

Apache CouchDB是由Apache软件基金会开发的自由开源NoSQL数据库。它可以用作单节点数据库或集群数据库。

CouchDB服务器将其数据存储在命名数据库中,该数据库包含具有JSON结构的文档。每个文档都包含许多字段和附件。

字段可以包括文本,数字,列表,布尔值等。CouchDB包括一个RESTful HTTP API,使您可以读取,创建,编辑和删除数据库文档。

在本教程中,我们将介绍CentOS 7安装CouchDB。在CentOS 7安装CouchDB的最简单方法是启用供应商软件源并安装CouchDB。

当安装完成后,运行systemctl命令启动CouchDB服务。你可以运行命令sudo systemctl status couchdb,查看CouchDB的服务状态。

sudo yum install -y yum-utils

sudo yum-config-manager --add-repo https://couchdb.apache.org/repo/couchdb.repo

sudo yum install -y couchdb
sudo systemctl enable --now couchdb
sudo systemctl status couchdb

配置CouchDB

CouchDB可以运行在单节点或集群模式。在此示例中,我们将以单节点配置部署CouchDB服务。CouchDB有两种配置方式,一种是浏览器,另一种是命令行。

在浏览器打开URL http://127.0.0.1:5984/_utils#setup。您可以使用Fauxton配置CouchDB,

我们将从命令行创建管理员用户和数据库。

Apache CouchDB数据和配置文件存储在/opt/couchdb目录。要创建管理员帐户,使用你喜欢的文本编辑器,打开文件local.ini

在本教程中,我们使用vim编辑文件local.ini。并在[admins]章节以username = password格式添加一行。

您可以使用相同的格式添加多个管理员帐户。添加新帐户后,请务必重新启动CouchDB服务。

完成后保存文件并退出vim,然后重新启动CouchDB服务。最后运行curl命令创建系统数据库_users_replicator_global_changes

sudo vim /opt/couchdb/etc/local.ini
[admins]
admin = mysecretpassword
/opt/couchdb/etc/local.ini
sudo systemctl restart couchdb
curl -u ADMINUSER:PASS -X PUT http://127.0.0.1:5984/_users
{"ok":true}

CouchDB入门

现在CouchDB服务器已在后台运行。要确认安装是否成功,请运行curl命令,该命令将以JSON格式打印CouchDB数据库的信息。

如果您更喜欢GUI,则可以访问CouchDB基于Web的界面Fauxton,网址为http://127.0.0.1:5984/_utils/

curl http://127.0.0.1:5984/
{ 
   "couchdb":"Welcome",
   "version":"2.3.1",
   "git_sha":"c298091a4",
   "uuid":"5e3878666b1077eb9d4a7ba7b06c251b",
   "features":[ 
      "pluggable-storage-engines",
      "scheduler"
   ],
   "vendor":{ 
      "name":"The Apache Software Foundation"
   }
}

我们已经向您展示如何在CentOS 7安装CouchDB。下一步是访问Apache CouchDB文档,并找到有关此主题的更多信息。

如有任何疑问,请随时发表评论。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK