-
Notifications
You must be signed in to change notification settings - Fork 0
Couchbase database server setup & connection
###Couchbase Server
Installing couchbase server is easy, just follow the instructions on its official website. After you have installed couchbase server. Log in to the console and add an additional bucket. Let's name it "sync_gateway". This bucket will be used to store the data collected by our devices.
Note: "sync_gateway" here is a bucket, it's not the same as the sync_gateway I will describe in the next section.
Couchbase server by defaults will be started automatically after installation. Also it will be started automatically every time you started you machine.
###Sync_gateway Follow the official instructions to install Sync_gateway. Sync_gateway will also be started automatically after installation, and also every time you started your machine.
In /home directory, you will see the folder named "sync_gateway". Inside this folder, you will see a file named "sync_gateway.json". By defaults, sync_gateway will use this configuration file to configure its connection to the couchbase server. However, you can add your own configuration file, just follow the guidelines on the official website.
A copy of my configuration file is included in this project, called "config_cdb.json":
Copy this configuration file to /opt/couchbase-sync-gateway/bin/
create a new directory called "data".
To connect sync_gateway service to the sync_gateway bucket on the server:
sudo service sync_gateway stop (to stop the existed sync_gateway service)
./sync_gateway config_cdb.json (to established new connection using config_cdb.json)
If the connection is successful, you need to keep the terminal open in order to maintain this status.
sudo dpkg -i [couchbase-server.deb/sync_gateway.deb] // to install the package.
sudo dpkg -r couchbase-sync-gateway //to completely uninstall
sudo service coucebase-server start/stop
sudo service sync_gateway start/stop
top (to check the runnign process)