Database¶
The INFRA environment requires a database which can be internal or external to Docker Swarm.
External database¶
To configure access to an external database, set the following variables depending on the database engine:
MySQL¶
DB_USER: "< Username to authenticate to the database >"
DB_USER_PASSWORD: "< Password to authenticate to the database >"
DB_NAME: "< Database name >"
DB_HOST: "< IP >"
DB_DIALECT: "mysql"
PostgreSQL¶
DB_USER: "< Username to authenticate to the database >"
DB_USER_PASSWORD: "< Password to authenticate to the database >"
DB_NAME: "< Database name >"
DB_HOST: "< IP >"
DB_DIALECT: "postgresql"
Add SSL support¶
To add SSL support for the database connection, use the following options in the Ansible inventory:
DB_SSL_REQUIRE: "true"
DB_SSL_CERT_LOCALPATH: "/local/path/cert.crt"
DB_SSL_KEY_LOCALPATH: "/local/path/key.key"
DB_SSL_CA_LOCALPATH: "/local/path/ca.crt"
Internal database¶
By default a MySQL server is included in the reemo-infra role. It will be deployed and configured automatically if an external database is not provided.
MySQL¶
By default a MySQL database is deployed in the Docker Swarm environment.
On a single-server architecture, the local directory /opt/reemo will be mounted into the MySQL container to store the database.
Warning
If you do not plan to use MySQL NDBCLUSTER, you must replicate the /opt/reemo directories so the MySQL container can restart
on another node in case of failure and retain all existing database data.
MySQL NDBCLUSTER¶
To enable MySQL NDBCLUSTER, add DB_DIALECT=NDBCLUSTER in the inventory, and the hostnames of the nodes in your Swarm cluster:
all:
vars:
API_LICENSE: "ewogICAg ... Uw5NXhGVDF0NFU2TkxOdjQvZU53PT0iCiAgICC9Cn0="
infra_manager:
vars:
DB_DIALECT: "NDBCLUSTER"
MYSQL_CLUSTER_DataMemory: 2G # increase DB memory (default 2G)
MYSQL_CLUSTER_PATH: "/data/mysqlcluster" # Path for NDBCLUSTER services data (default "/data/mysqlcluster")
MYSQL_NODE_HOSTNAME_DB1: "infra1"
MYSQL_NODE_HOSTNAME_DB2: "infra2"
MYSQL_NODE_HOSTNAME_DB3: "infra3"
hosts:
infra_manager1:
ansible_host: "10.0.0.1"
infra_manager2:
ansible_host: "10.0.0.2"
infra_manager3:
ansible_host: "10.0.0.3"
Tip
NDBCLUSTER requires at least 8 GB of RAM per node.
Warning
Recommended latency is under 1 ms between nodes. Between 1 and 5 ms performance may drop. Above 5 ms there is risk of slowdowns and instability.