GithubHelp home page GithubHelp logo

klavsklavsen / couchbase-cluster-go Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tleyden/couchbase-cluster-go

0.0 1.0 0.0 2.28 MB

Go library for managing a couchbase cluster via etcd and the couchbase REST API

License: Apache License 2.0

Go 99.53% Dockerfile 0.47%

couchbase-cluster-go's Introduction

Join the chat at https://gitter.im/tleyden/couchbase-cluster-go

This is a Go library that helps initialize and manage a Couchbase Server cluster running under CoreOS.

Instructions

Power Tips

Running on the latest code

Since the docker image can be out of date, and rebuilding it can be time consuming, there is a way to force couchbase-cluster-go to run the latest version of the code:

$ etcdctl set /couchbase.com/enable-code-refresh true
$ sudo docker run --net=host tleyden5iwx/couchbase-cluster-go update-wrapper couchbase-fleet launch-cbs \
  --version 3.0.1 \
  --num-nodes 3 \
  --userpass "user:passw0rd" 
$ sudo docker run --net=host tleyden5iwx/couchbase-cluster-go update-wrapper sync-gw-cluster launch-sgw \
  --num-nodes=1 \
  --config-url=http://git.io/b9PK \
  --create-bucket todos \
  --create-bucket-size 512 \ 
  --create-bucket-replicas 1

Running Sync Gateway behind an Nginx proxy

You need to pass another parameter: --launch-nginx when launching Sync Gateway, and you also need to be running on the latest code.

The easiest way is to replace the third command in Running on the latest code with:

$ sudo docker run --net=host tleyden5iwx/couchbase-cluster-go update-wrapper sync-gw-cluster launch-sgw --launch-nginx --num-nodes=1 --config-url=http://git.io/b9PK --create-bucket todos --create-bucket-size 512 --create-bucket-replicas 1

Verify Internal

After the Sync Gateway instance(s) launch, find the IP of the nginx node by:

$ fleetctl list-units
UNIT				MACHINE				ACTIVE	SUB
...
nginx.service			5c7662f4.../10.136.111.112	active	running
...

From one of the machines in the coreos cluster, try issuing a request to port 80 of that ip:

$ curl 10.136.111.112
{"couchdb":"Welcome","vendor":{"name":"Couchbase Sync Gateway","version":1},"version":"Couchbase Sync Gateway/master(a47a17f)"}

Verify External

Finally, you can find the public ip and then pasting the ip into your web browser on your workstation. If it doesn't work, you may need to update your AWS Security Group to allow access to port 80 from any ip address.

You might also want to change the default Security Group to change port 4984 to only be accessible from within the CloudFormation group (as opposed to accessible from any address).

Sync Gateway -> Couchbase Server service discovery

There is a mechanism that will rewrite the Sync Gateway config provided before launching the Sync Gateway. To leverage this, simply modify your Sync Gateway config so that the server field contains http://{{ .COUCHBASE_SERVER_IP }}:8091.

A live Couchbase Server node will be discovered via etcd and the value in the Sync Gateway config will be replaced with that node's ip address.

Complete Sync Gateway Config example

Destroying the cluster

The following commands will stop and destroy all units (Couchbase Server, Sync Gateway, and otherwise)

$ sudo docker run --net=host tleyden5iwx/couchbase-cluster-go update-wrapper couchbase-fleet stop --all-units
$ sudo docker run --net=host tleyden5iwx/couchbase-cluster-go update-wrapper couchbase-fleet destroy --all-units

This command will delete all persistent data in the /opt/var/couchbase directory across all machines on the cluster.

WARNING - this will destroy all of your data stored in Couchbase

fleetctl list-machines | grep -v MACHINE | awk '{print $2}' | xargs -I{} ssh {} 'sudo rm -rf /opt/couchbase/var/'

Workaround fleetctl start issues

Units will frequently come up as failed due to fleet issue 1149. To workaround [email protected] coming up as failed, do the following:

$ fleetctl cat [email protected] > [email protected]
$ fleetctl stop [email protected]
$ fleetctl destroy [email protected]
$ fleetctl start [email protected]

The last command will use the unit file saved in the first step.

Issue Tracker

Please file issues to the couchbase-server-coreos repo.

Related Work

couchbase-cluster-go's People

Contributors

derekperkins avatar gitter-badger avatar klavsklavsen avatar matthewvalimaki avatar paulcapestany avatar tleyden avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.