首页 > 技术文章 > couchbase数据库-step 1- windows 环境下搭建

loongdao 2020-11-16 22:52 原文

1、couchbase server 安装

          1.1   操作系统/浏览器要求:

https://docs.couchbase.com/server/current/install/install-platforms.html       注意在win10系统下只支持数据库的开发与测试,而在Windows Server 2019/2016环境下才支持数据库的开发/测试/生产。

           1.2  物理硬件要求:

Minimum Specifications*Recommended Specifications**

CPU

2 GHz dual core x86_64

3 GHz quad core x86_64 and above

3 GHz six core x86_64 when using Cross Datacenter Replication (XDCR) and Views

RAM

4 GB (physical)

16 GB (physical) and above

Storage (disk space)

8 GB (block-based; HDD, SSD, EBS, iSCSI)

Network file systems such as CIFS and NFS are not supported.

16 GB and above (block-based; HDD, SSD, EBS, iSCSI)

Network file systems such as CIFS and NFS are not supported.

         1.3 开放端口说明:

Table 1. All Couchbase Server Ports, Listed by Communication Path
Communication PathDefault Ports

Node-local only

Unencrypted: 9119, 9998, 11213, 21200, 21300

Encrypted: 21250, 21350

Node-to-node

Unencrypted: 4369, 8091-8094, 9100-9105, 9110-9118, 9120-9122, 9130, 9999, 11209-11210, 21100

Encrypted: 9999, 11207, 18091-18094, 19130, 21150

Client-to-node

Unencrypted: 8091-8096, 9140 , 11210, 11211

Encrypted: 11207, 18091-18096 

XDCR (cluster-to-cluster)

  • Version 1 (CAPI)

    • Unencrypted: 8091, 8092

  • Version 2 (XMEM)

    • Unencrypted: 8091, 8092, 11210

    • Encrypted: 11207, 18091, 18092

  If enforcing TLS encryption, these ports may be blocked outside of a Couchbase Server cluster but need to remain open between nodes.
  Certain support and diagnostic requests may run against ports other than the administration port (8091). These are expected to execute locally on a node and so do not require external access.

 

我们使用的模式是android app 与 数据库进行同步,即 client-to-node模式。故在服务器上要使用8091-8096, 9140 ,11210, 11211  9个端口,故这几个端口不能被占用。但对外开放或需跳转(比如android app程序要通过公网访问政府内网)的端口只有其中三个(后面会描述)。

1.4 阿里云 windows server 2016 下安装

       

1.4.1  下载couchbase server  6.6版本


 

1.4.2  双击默认安装到结束

1.4.3 如果在服务器以外的浏览器上进行数据库维护的话,就在阿里云“安全策略中”放开8091端口,8091是数据库操作界面访问端口。如果只在服务器上的浏览器上进行数据库维护,无需把服务器的8091端口开放给外网。

 

 1.4.4  点击“setup new cluster",创建一个数据库。

1.4.5  为数据库设置用户名与密码loong***

 

 

 

 点击finish with defaults 

1.4.6   为数据库添加一个bucket(我是否可以认为一个表),命名为 policebkt,   一切默认设置。至此,数据库服务安装完成

 

  

 

 

 

 

 

 1.4.7 启动与暂停数据库服务(有三种办法,只介绍最简单的一种)

在安装路径下运行这两个批处理文件就行

 

 

 

2、sync-gateway 安装与配制

 

2.1  端口要求:

如果把sync-gateway与couchbase server 安装在同一个服务器上,只需把服务器的4984端口开放就可以了,用于android端的数据库同步。

2.2  couchbase server的配置要求  :

在“security"中添加一个同步网关访问用户 

 

 

2.3 下载双击安装  sync-gateway2.8.0    

 

 

 安装成功之后,打开程序图标,会看到4985端口下配置情况。 

 

2.4 配置sync_gateway.json文件

"databases": {
"db": {
"server": "couchbase://localhost",
"username": "username",
"password": "password",
"bucket": "default",

每个参数详细的配置计划在后面文章中一一介绍,在这里记住有一个坑,"db"参数与“bucket"参数要用一个,都是server数据库中的bucket的名字。

 

3、android app 配制同步/用户名+密码访问

 

推荐阅读