Git Product home page Git Product logo

etcdb's Introduction

etcdb is a work-in-progress to provide an implementation of the etcd REST API on top of a SQL backend.

Contact

For bugs, questions, comments, corrections, suggestions, etc., open an issue in rancher/rancher with a title starting with [etcdb] .

Or just click here to create a new issue.

Usage

Database setup

To create the required database tables, run the etcdb command once with the -init-db flag. This will create the tables and then exit (see below for the database connection parameters):

etcdb -init-db <database type> <connection parameters>

Starting the server

Etcdb supports either MySQL or Postgres backend databases. The etcdb command takes two required arguments, the type of database to connect to, and parameters for the database connection. Here are examples with the most commonly specified parameters:

etcdb postgres "user=username password=password host=hostname dbname=dbname sslmode=disable"

etcdb mysql username:password@tcp(hostname:3306)/dbname

Additional parameters are documented for each of the Go database drivers:

Client connections

For compatibility with etcd, the etcdb server by default listens on ports 2379 and 4001 on localhost.

To listen on other ports or network interfaces, etcdb takes two options -listen-client-urls and -advertise-client-urls which are compatible with the same options on the etcd server.

-listen-client-urls specifies the hosts and ports that the server will listen for connections on.

-advertise-client-urls specifies the matching URLs that are accessible to the client. When cluster aware clients such as etcdctl connect to the server, this is the list of URLs it will "advertise" for these clients to connect to.

To listen on a public network interface, these options can have the same value:

etcdb \
  -listen-client-urls http://10.0.0.1:92379 \
  -advertise-client-urls http://10.0.0.1:92379 \
  postgres "sslmode=disable"

However, if for example, you're running the server in a Docker container, forwarding the external port 92379 to the container's port 2379. You would would start etcdb listening for connections on all container IPs on port 2379, but advertise the client URL with the publicly accessible IP and port number:

etcdb \
  -listen-client-urls http://0.0.0.0:2379 \
  -advertise-client-urls http://${PUBLIC_IP}:92379 \
  postgres "sslmode=disable"

Testing

Unit tests

The Makefile has a helper for running the Go tests:

make test

Integration testing

The integration-tests directory contains tests using the etcdctl command to exercise the public etcd-compatible API.

The integration tests are written in Bash and use basht to run. This can be installed with:

make test-deps

The tests also expect etcdctl and docker to be on the path. The DOCKER_HOST environment variable needs to be set to a tcp:// address since the tests need the Docker IP for etcdctl to connect to.

Run the integration tests with:

make test-integration

etcdb's People

Contributors

mgood 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.