©2015 - 2022 Chad’s Technoworks. Disclaimer and Terms of Use

Chad’s TechnoWorks My Journal On Technology

Information Technology

COUCHBASE MOBILE SYNC GATEWAY - page 2

 Prev< 1 2

COUCHBASE SYNC GATEWAY ROOT INSTALLATION

For purposes of vendor support and production deployments, an installation of Sync Gateway by root is recommended.

Here are some of my notes that demonstrates the process.


[couchbas@lxnode4 ~]$ cp couchbase-sync-gateway-enterprise_1.3.0-274_x86_64.rpm /tmp

[couchbas@lxnode4 ~]$ ls -l /tmp/couch*.rpm

-rw-r--r--. 1 couchbas nosql 12798456 Aug 24 12:54 /tmp/couchbase-sync-gateway-enterprise_1.3.0-274_x86_64.rpm

[couchbas@lxnode4 ~]$ chmod a+r /tmp/couchbase-sync-gateway-enterprise_1.3.0-274_x86_64.rpm

[couchbas@lxnode4 ~]$ ls -l /tmp/couch*.rpm

-rw-r--r--. 1 couchbas nosql 12798456 Aug 24 12:54 /tmp/couchbase-sync-gateway-enterprise_1.3.0-274_x86_64.rpm

[couchbas@lxnode4 ~]$ su -

Password:

[root@lxnode4 ~]#

[root@lxnode4 ~]# rpm -i /tmp/couchbase-sync-gateway-enterprise_1.3.0-274_x86_64.rpm

sync_gateway start/running, process 5637


You have successfully installed Couchbase sync_gateway.


You can find sample sync_gateway configuration files in the /opt/couchbase-sync-gateway/examples folder.


You can control the Couchbase sync_gateway service by using the following command:


  initctl start sync_gateway


That's it! sync_gateway is now running on port 4984. We've setup a simple in-memory database

which works great for exploring sync_gateway's capabilities. A limited console is available

by opening your browser to http://localhost:4985/_admin/.


The command-line options are:


  -adminInterface=":4985": Address to bind admin interface to

  -bucket="sync_gateway": Name of bucket

  -dbname="": Name to assign to this database (defaults to name of bucket)

  -interface=":4984": Address to bind to

  -log="": Log keywords, comma separated

  -personaOrigin="": Base URL that clients use to connect to the server

  -pool="default": Name of pool

  -pretty=false: Pretty-print JSON responses

  -url="walrus:": Address of Couchbase server

  -verbose=false: Log more info about requests



By using this software you agree to the End User License Agreement.

See /opt/couchbase-sync-gateway/LICENSE.txt.


[root@lxnode4 ~]#


The installation creates 2 OS accounts and group:

couchbase:couchbase

sync_gateway:sync_gateway


The couchbase user owns the installed binaries in /opt/couchbase-sync-gateway.

While the sync_gateway user owns the Sync Gateway config file sync_gateway.json in /home/sync_gateway directory. This file is the only file referenced when starting the service.


After the installation by root, the sync_gateway process will be running using the default configuration that uses a local walrus database.


[sync_gateway@lxnode4 ~]$ ps -ef | grep sync_gateway

root      2951  2950  0 16:48 ?        00:00:00 su --session-command /opt/couchbase-sync-gateway/bin/sync_gateway /home/sync_gateway/sync_gateway.json >> /home/sync_gateway/logs/sync_gateway_access.log 2>> /home/sync_gateway/logs/sync_gateway_error.log sync_gateway

911       2953  2951  0 16:48 ?        00:00:00 bash -c /opt/couchbase-sync-gateway/bin/sync_gateway /home/sync_gateway/sync_gateway.json >> /home/sync_gateway/logs/sync_gateway_access.log 2>> /home/sync_gateway/logs/sync_gateway_error.log

911       2954  2953  0 16:48 ?        00:00:03 /opt/couchbase-sync-gateway/bin/sync_gateway /home/sync_gateway/sync_gateway.json

root      5561  5545  0 22:45 pts/0    00:00:00 su - sync_gateway

911       5586  5563  0 22:45 pts/0    00:00:00 grep sync_gateway

[sync_gateway@lxnode4 ~]$



Here is a sample content of the default config file:


[sync_gateway@lxnode4 ~]$ pwd

/home/sync_gateway

[sync_gateway@lxnode4 ~]$

[sync_gateway@lxnode4 ~]$ ls -l

total 12

drwxr-xr-x. 2 sync_gateway sync_gateway 4096 Aug 29 10:46 data

drwxr-xr-x. 2 sync_gateway sync_gateway 4096 Aug 24 12:59 logs

-rw-r--r--. 1 sync_gateway sync_gateway  230 Aug 24 12:59 sync_gateway.json

[sync_gateway@lxnode4 ~]$

[sync_gateway@lxnode4 ~]$ cat sync_gateway.json

{

 "log": ["HTTP+"],

 "adminInterface": "127.0.0.1:4985",

 "interface": "0.0.0.0:4984",

 "databases": {

  "db": {

   "server": "walrus:data",

   "users": {

    "GUEST": {"disabled": false, "admin_channels": ["*"] }

   }

  }

 }

}


[sync_gateway@lxnode4 ~]$



As an administrator, you need the following sudo privileges:


initctl start sync_gateway

initctl stop sync_gateway

su – sync_gateway

su - couchbase