MXS-1803: Simplify docker image
The docker image now simply installs the latest MaxScale version instead of building it. This significantly reduces the amount of maintenance that the image requires. Updated the configurations to allow runtime definition of servers and updated README.md to reflect the changes in the files. Pointed links to 2.2 instead of develop. Removed text from the readme that was not strictly related to running the MaxScale image.
This commit is contained in:
@ -1,60 +1,48 @@
|
||||
# MariaDB MaxScale Docker image
|
||||
|
||||
This Docker image runs MariaDB MaxScale. The MaxScale version used to build the
|
||||
image is an unreleased development build so this should not be used for a
|
||||
production system.
|
||||
This Docker image runs the latest GA version of MariaDB MaxScale.
|
||||
|
||||
## Building
|
||||
|
||||
Run the following command to build the image.
|
||||
|
||||
```
|
||||
sudo docker build -t maxscale .
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
MaxScale is a proxy so its configuration is dependent on the use case and there
|
||||
is no generally valid default. The configuration file inside the image (shown in
|
||||
[Default configuration](#default-configuration)) includes only the bare minimum
|
||||
to start MaxScale and has no useful services. The simplest way to add more to
|
||||
the configuration is to place another file (*my_config.cnf*) in a directory
|
||||
(*/my_dir/*) and then mount the directory to */etc/maxscale.cnf.d/* inside the
|
||||
container when starting it. MaxScale will add any files inside
|
||||
*/etc/maxscale.cnf.d/* to its configuration.
|
||||
You must mount your configuration file into `/etc/maxscale.cnf.d/`. To do
|
||||
this, pass it as an argument to the `-v` option:
|
||||
|
||||
```
|
||||
docker run --network host --rm -v /my_dir:/etc/maxscale.cnf.d/ maxscale
|
||||
docker run -v $PWD/my-maxscale.cnf:/etc/maxscale.cnf.d/my-maxscale.cnf maxscale:latest
|
||||
```
|
||||
|
||||
In the examples, the Docker network mode is set to *host* so that the container
|
||||
has full network access (`--network host`).
|
||||
|
||||
To replace the configuration file completely, start MaxScale with `-f <path_to_config>`.
|
||||
Adding custom options removes all default options defined in the image. When
|
||||
adding new flags to MaxScale, one should add back `-l stdout` to print log to
|
||||
stdout.
|
||||
By default, MaxScale runs with the `-l stdout` arguments. To explicitly
|
||||
define a configuration file, use the `-f /path/to/maxscale.cnf` argument
|
||||
and add `-l stdout` after it.
|
||||
|
||||
```
|
||||
docker run --network host --rm -v /my_dir:/container_dir maxscale -l stdout -f /container_dir/my_config.cnf
|
||||
```
|
||||
|
||||
To save logs to */my_dir*, remove the `-l stdout` and set */container_dir* as
|
||||
log directory with the option `-L /container_dir`.
|
||||
|
||||
```
|
||||
docker run --network host --rm -v /my_dir:/container_dir maxscale -L /container_dir -f /container_dir/my_config.cnf
|
||||
docker run --network host --rm -v /my_dir:/container_dir maxscale -f /path/to/maxscale.cnf -l stdout
|
||||
```
|
||||
|
||||
## Default configuration
|
||||
|
||||
```
|
||||
# MaxScale documentation on GitHub:
|
||||
# https://github.com/mariadb-corporation/MaxScale/blob/develop/Documentation/Documentation-Contents.md
|
||||
# https://github.com/mariadb-corporation/MaxScale/blob/2.2/Documentation/Documentation-Contents.md
|
||||
|
||||
# Complete list of configuration options:
|
||||
# https://github.com/mariadb-corporation/MaxScale/blob/develop/Documentation/Getting-Started/Configuration-Guide.md
|
||||
# https://github.com/mariadb-corporation/MaxScale/blob/2.2/Documentation/Getting-Started/Configuration-Guide.md
|
||||
|
||||
# Global parameters
|
||||
|
||||
[maxscale]
|
||||
threads=2
|
||||
threads=auto
|
||||
|
||||
# This service enables the use of the MaxAdmin interface
|
||||
# MaxScale administration guide:
|
||||
# https://github.com/mariadb-corporation/MaxScale/blob/develop/Documentation/Reference/MaxAdmin.md
|
||||
# https://github.com/mariadb-corporation/MaxScale/blob/2.2/Documentation/Reference/MaxAdmin.md
|
||||
[MaxAdmin-Service]
|
||||
type=service
|
||||
router=cli
|
||||
@ -66,27 +54,21 @@ protocol=maxscaled
|
||||
socket=default
|
||||
```
|
||||
|
||||
## Example configuration extension
|
||||
## Example base configuration
|
||||
|
||||
```
|
||||
# Server definitions
|
||||
# Set the address of the server to the network address of a MySQL server.
|
||||
|
||||
[server1]
|
||||
type=server
|
||||
address=127.0.0.1
|
||||
port=3306
|
||||
protocol=MySQLBackend
|
||||
# Global parameters
|
||||
[maxscale]
|
||||
threads=auto
|
||||
|
||||
# Monitor for the servers
|
||||
# This will keep MaxScale aware of the state of the servers.
|
||||
# MySQL Monitor documentation:
|
||||
# https://github.com/mariadb-corporation/MaxScale/blob/develop/Documentation/Monitors/MySQL-Monitor.md
|
||||
# https://github.com/mariadb-corporation/MaxScale/blob/2.2/Documentation/Monitors/MariaDB-Monitor.md
|
||||
|
||||
[MySQL-Monitor]
|
||||
[MariaDB-Monitor]
|
||||
type=monitor
|
||||
module=mysqlmon
|
||||
servers=server1
|
||||
module=mariadbmon
|
||||
user=myuser
|
||||
passwd=mypwd
|
||||
monitor_interval=1000
|
||||
@ -95,23 +77,21 @@ monitor_interval=1000
|
||||
# Service Definition for a read-only service and a read/write splitting service.
|
||||
|
||||
# ReadConnRoute documentation:
|
||||
# https://github.com/mariadb-corporation/MaxScale/blob/develop/Documentation/Routers/ReadConnRoute.md
|
||||
# https://github.com/mariadb-corporation/MaxScale/blob/2.2/Documentation/Routers/ReadConnRoute.md
|
||||
|
||||
[Read-Only-Service]
|
||||
type=service
|
||||
router=readconnroute
|
||||
servers=server1
|
||||
user=myuser
|
||||
passwd=mypwd
|
||||
router_options=slave
|
||||
|
||||
# ReadWriteSplit documentation:
|
||||
# https://github.com/mariadb-corporation/MaxScale/blob/develop/Documentation/Routers/ReadWriteSplit.md
|
||||
# https://github.com/mariadb-corporation/MaxScale/blob/2.2/Documentation/Routers/ReadWriteSplit.md
|
||||
|
||||
[Read-Write-Service]
|
||||
type=service
|
||||
router=readwritesplit
|
||||
servers=server1
|
||||
user=myuser
|
||||
passwd=mypwd
|
||||
max_slave_connections=100%
|
||||
@ -131,3 +111,10 @@ service=Read-Write-Service
|
||||
protocol=MySQLClient
|
||||
port=4006
|
||||
```
|
||||
|
||||
For base configurations, servers are defined at runtime. Run the following
|
||||
command to create a server and link it into all services and monitors.
|
||||
|
||||
```
|
||||
maxctrl create server <name> <host> <port> --monitors MariaDB-Monitor --services Read-Only-Service Read-Write-Service
|
||||
```
|
||||
|
Reference in New Issue
Block a user