You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cassandra/content.md
+3-27
Original file line number
Diff line number
Diff line change
@@ -13,33 +13,17 @@ Apache Cassandra is an open source distributed database management system design
13
13
Starting a Cassandra instance is simple:
14
14
15
15
```console
16
-
$ docker run --name some-%%REPO%% -d %%IMAGE%%:tag
16
+
$ docker run --name some-%%REPO%% --network some-network -d %%IMAGE%%:tag
17
17
```
18
18
19
19
... where `some-%%REPO%%` is the name you want to assign to your container and `tag` is the tag specifying the Cassandra version you want. See the list above for relevant tags.
20
20
21
-
## Connect to Cassandra from an application in another Docker container
22
-
23
-
This image exposes the standard Cassandra ports (see the [Cassandra FAQ](https://wiki.apache.org/cassandra/FAQ#ports)), so container linking makes the Cassandra instance available to other application containers. Start your application container like this in order to link it to the Cassandra container:
24
-
25
-
```console
26
-
$ docker run --name some-app --link some-%%REPO%%:%%REPO%% -d app-that-uses-cassandra
27
-
```
28
-
29
21
## Make a cluster
30
22
31
23
Using the environment variables documented below, there are two cluster scenarios: instances on the same machine and instances on separate machines. For the same machine, start the instance as described above. To start other instances, just tell each new node where the first is.
... where `some-%%REPO%%` is the name of your original Cassandra Server container, taking advantage of `docker inspect` to get the IP address of the other container.
38
-
39
-
Or you may use the docker run --link option to tell the new node where the first is:
40
-
41
-
```console
42
-
$ docker run --name some-cassandra2 -d --link some-cassandra:cassandra %%IMAGE%%:tag
For separate machines (ie, two VMs on a cloud provider), you need to tell Cassandra what IP address to advertise to the other nodes (since the address of the container is behind the docker bridge).
The following command starts another Cassandra container instance and runs `cqlsh` (Cassandra Query Language Shell) against your original Cassandra container, allowing you to execute CQL statements against your database instance:
62
46
63
47
```console
64
-
$ docker run -it --link some-%%REPO%%:cassandra --rm %%IMAGE%% sh -c 'exec cqlsh "$CASSANDRA_PORT_9042_TCP_ADDR"'
48
+
$ docker run -it --network some-network --rm %%IMAGE%% cqlsh some-%%REPO%%
65
49
```
66
50
67
-
... or (simplified to take advantage of the `/etc/hosts` entry Docker adds for linked containers):
68
-
69
-
```console
70
-
$ docker run -it --link some-%%REPO%%:cassandra --rm %%IMAGE%% cqlsh cassandra
71
-
```
72
-
73
-
... where `some-%%REPO%%` is the name of your original Cassandra Server container.
74
-
75
51
More information about the CQL can be found in the [Cassandra documentation](https://cassandra.apache.org/doc/latest/cql/index.html).
76
52
77
53
## Container shell access and viewing Cassandra logs
Then, access it via `http://localhost:8080` or `http://host-ip:8080` in a browser.
24
24
25
-
There are multiple database types supported by this image, most easily used via standard container linking. In the default configuration, SQLite can be used to avoid a second container and write to flat-files. More detailed instructions for different (more production-ready) database types follow.
25
+
There are multiple database types supported by this image, most easily used via Docker networks. In the default configuration, SQLite can be used to avoid a second container and write to flat-files. More detailed instructions for different (more production-ready) database types follow.
26
26
27
27
When first accessing the webserver provided by this image, it will go through a brief setup process. The details provided below are specifically for the "Set up database" step of that configuration process.
28
28
29
29
## MySQL
30
30
31
31
```console
32
-
$ docker run --name some-%%REPO%% --link some-mysql:mysql -d %%IMAGE%%
32
+
$ docker run --name some-%%REPO%% --network some-network -d %%IMAGE%%
33
33
```
34
34
35
35
- Database type: `MySQL, MariaDB, or equivalent`
36
36
- Database name/username/password: `<details for accessing your MySQL instance>` (`MYSQL_USER`, `MYSQL_PASSWORD`, `MYSQL_DATABASE`; see environment variables in the description for [`mysql`](https://hub.docker.com/_/mysql/))
37
-
- ADVANCED OPTIONS; Database host: `mysql` (for using the `/etc/hosts` entry added by `--link` to access the linked container's MySQL instance)
37
+
- ADVANCED OPTIONS; Database host: `some-mysql` (for using the DNS entry added by `--network` to access the MySQL container)
38
38
39
39
## PostgreSQL
40
40
41
41
```console
42
-
$ docker run --name some-%%REPO%% --link some-postgres:postgres -d %%IMAGE%%
42
+
$ docker run --name some-%%REPO%% --network some-network -d %%IMAGE%%
43
43
```
44
44
45
45
- Database type: `PostgreSQL`
46
46
- Database name/username/password: `<details for accessing your PostgreSQL instance>` (`POSTGRES_USER`, `POSTGRES_PASSWORD`; see environment variables in the description for [`postgres`](https://hub.docker.com/_/postgres/))
47
-
- ADVANCED OPTIONS; Database host: `postgres` (for using the `/etc/hosts` entry added by `--link` to access the linked container's PostgreSQL instance)
47
+
- ADVANCED OPTIONS; Database host: `some-postgres` (for using the DNS entry added by `--network` to access the PostgreSQL container)
48
48
49
49
## Volumes
50
50
@@ -61,7 +61,7 @@ $ docker run --rm %%IMAGE%% tar -cC /var/www/html/sites . | tar -xC /path/on/hos
61
61
This can then be bind-mounted into a new container:
62
62
63
63
```console
64
-
$ docker run --name some-%%REPO%% --link some-postgres:postgres -d \
64
+
$ docker run --name some-%%REPO%% --network some-network -d \
... where `some-%%REPO%%` is the name you want to assign to your container, `my-secret-pw` is the password to be set for the MySQL root user and `tag` is the tag specifying the MySQL version you want. See the list above for relevant tags.
22
22
23
-
## Connect to MySQL from an application in another Docker container
24
-
25
-
Since MariaDB is intended as a drop-in replacement for MySQL, it can be used with many applications.
26
-
27
-
This image exposes the standard MySQL port (3306), so container linking makes the MySQL instance available to other application containers. Start your application container like this in order to link it to the MySQL container:
28
-
29
-
```console
30
-
$ docker run --name some-app --link some-%%REPO%%:mysql -d application-that-uses-mysql
31
-
```
32
-
33
23
## Connect to MariaDB from the MySQL command line client
34
24
35
25
The following command starts another `%%IMAGE%%` container instance and runs the `mysql` command line client against your original `%%IMAGE%%` container, allowing you to execute SQL statements against your database instance:
36
26
37
27
```console
38
-
$ docker run -it --link some-%%REPO%%:mysql --rm %%IMAGE%% sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'
28
+
$ docker run -it --network some-network --rm %%IMAGE%% mysql -hsome-%%REPO%% -uexample-user -p
39
29
```
40
30
41
-
... where `some-%%REPO%%` is the name of your original `%%IMAGE%%` container.
31
+
... where `some-%%REPO%%` is the name of your original `%%IMAGE%%` container (connected to the `some-network` Docker network).
42
32
43
-
This image can also be used as a client for non-Docker or remote MariaDB instances:
33
+
This image can also be used as a client for non-Docker or remote instances:
44
34
45
35
```console
46
36
$ docker run -it --rm %%IMAGE%% mysql -hsome.mysql.host -usome-mysql-user -p
@@ -60,15 +50,15 @@ The `docker exec` command allows you to run commands inside a Docker container.
60
50
$ docker exec -it some-%%REPO%% bash
61
51
```
62
52
63
-
The MariaDB Server log is available through Docker's container log:
53
+
The log is available through Docker's container log:
64
54
65
55
```console
66
56
$ docker logs some-%%REPO%%
67
57
```
68
58
69
59
## Using a custom MySQL configuration file
70
60
71
-
The MariaDB startup configuration is specified in the file `/etc/mysql/my.cnf`, and that file in turn includes any files found in the `/etc/mysql/conf.d` directory that end with `.cnf`. Settings in files in this directory will augment and/or override settings in `/etc/mysql/my.cnf`. If you want to use a customized MySQL configuration, you can create your alternative configuration file in a directory on the host machine and then mount that directory location as `/etc/mysql/conf.d` inside the `%%IMAGE%%` container.
61
+
The startup configuration is specified in the file `/etc/mysql/my.cnf`, and that file in turn includes any files found in the `/etc/mysql/conf.d` directory that end with `.cnf`. Settings in files in this directory will augment and/or override settings in `/etc/mysql/my.cnf`. If you want to use a customized MySQL configuration, you can create your alternative configuration file in a directory on the host machine and then mount that directory location as `/etc/mysql/conf.d` inside the `%%IMAGE%%` container.
72
62
73
63
If `/my/custom/config-file.cnf` is the path and name of your custom configuration file, you can start your `%%IMAGE%%` container like this (note that only the directory path of the custom config file is used in this command):
Copy file name to clipboardExpand all lines: memcached/content.md
+2-10
Original file line number
Diff line number
Diff line change
@@ -12,20 +12,12 @@ Memcached's APIs provide a very large hash table distributed across multiple mac
12
12
$ docker run --name my-memcache -d %%IMAGE%%
13
13
```
14
14
15
-
Start your memcached container with the above command and then you can connect you app to it with standard linking:
16
-
17
-
```console
18
-
$ docker run --link my-memcache:memcache -d my-app-image
19
-
```
20
-
21
-
The memcached server information would then be available through the ENV variables generated by the link as well as through DNS as `memcache` from `/etc/hosts`.
22
-
23
-
How to set the memory usage for memcached
15
+
## Setting Memory Usage
24
16
25
17
```console
26
18
$ docker run --name my-memcache -d %%IMAGE%% memcached -m 64
27
19
```
28
20
29
-
This would set the memcache server to use 64 megabytes for storage.
21
+
This would set the Memcached server to use 64 megabytes for storage.
30
22
31
23
For infomation on configuring your memcached server, see the extensive [wiki](https://github.com/memcached/memcached/wiki).
## Connect to MongoDB from another Docker container
22
22
23
-
The MongoDB server in the image listens on the standard MongoDB port, `27017`, so connecting via container linking or Docker networks will be the same as connecting to a remote `mongod`. The following example starts another MongoDB container instance and runs the `mongo` command line client against the original MongoDB container from the example above, allowing you to execute MongoDB statements against your database instance:
23
+
The MongoDB server in the image listens on the standard MongoDB port, `27017`, so connecting via Docker networks will be the same as connecting to a remote `mongod`. The following example starts another MongoDB container instance and runs the `mongo` command line client against the original MongoDB container from the example above, allowing you to execute MongoDB statements against your database instance:
... where `some-%%REPO%%` is the name of your original `mongo` container.
@@ -107,13 +107,13 @@ These variables, used in conjunction, create a new user and set that user's pass
107
107
The following is an example of using these two variables to create a MongoDB instance and then using the `mongo` cli to connect against the `admin` authentication database.
108
108
109
109
```console
110
-
$ docker run -d --name some-%%REPO%% \
110
+
$ docker run -d --network some-network --name some-%%REPO%% \
111
111
-e MONGO_INITDB_ROOT_USERNAME=mongoadmin \
112
112
-e MONGO_INITDB_ROOT_PASSWORD=secret \
113
113
%%IMAGE%%
114
114
115
-
$ docker run -it --rm --link some-%%REPO%%:mongo %%IMAGE%% \
116
-
mongo --host mongo \
115
+
$ docker run -it --rm --network some-network %%IMAGE%% \
... where `some-%%REPO%%` is the name you want to assign to your container, `my-secret-pw` is the password to be set for the MySQL root user and `tag` is the tag specifying the MySQL version you want. See the list above for relevant tags.
20
20
21
-
## Connect to MySQL from an application in another Docker container
22
-
23
-
This image exposes the standard MySQL port (3306), so container linking makes the MySQL instance available to other application containers. Start your application container like this in order to link it to the MySQL container:
24
-
25
-
```console
26
-
$ docker run --name some-app --link some-%%REPO%%:mysql -d application-that-uses-mysql
27
-
```
28
-
29
21
## Connect to MySQL from the MySQL command line client
30
22
31
23
The following command starts another `%%IMAGE%%` container instance and runs the `mysql` command line client against your original `%%IMAGE%%` container, allowing you to execute SQL statements against your database instance:
32
24
33
25
```console
34
-
$ docker run -it --link some-%%REPO%%:mysql --rm %%IMAGE%% sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'
26
+
$ docker run -it --network some-network --rm %%IMAGE%% mysql -hsome-%%REPO%% -uexample-user -p
35
27
```
36
28
37
-
... where `some-%%REPO%%` is the name of your original `%%IMAGE%%` container.
29
+
... where `some-%%REPO%%` is the name of your original `%%IMAGE%%` container (connected to the `some-network` Docker network).
38
30
39
-
This image can also be used as a client for non-Docker or remote MySQL instances:
31
+
This image can also be used as a client for non-Docker or remote instances:
40
32
41
33
```console
42
34
$ docker run -it --rm %%IMAGE%% mysql -hsome.mysql.host -usome-mysql-user -p
@@ -56,7 +48,7 @@ The `docker exec` command allows you to run commands inside a Docker container.
56
48
$ docker exec -it some-%%REPO%% bash
57
49
```
58
50
59
-
The MySQL Server log is available through Docker's container log:
51
+
The log is available through Docker's container log:
... where `some-%%REPO%%` is the name you want to assign to your container, `my-secret-pw` is the password to be set for the MySQL root user and `tag` is the tag specifying the MySQL version you want. See the list above for relevant tags.
22
22
23
-
## Connect to MySQL from an application in another Docker container
24
-
25
-
Since Percona Server for MySQL is intended as a drop-in replacement for MySQL, it can be used with many applications.
26
-
27
-
This image exposes the standard MySQL port (3306), so container linking makes the MySQL instance available to other application containers. Start your application container like this in order to link it to the MySQL container:
28
-
29
-
```console
30
-
$ docker run --name some-app --link some-%%REPO%%:mysql -d application-that-uses-mysql
31
-
```
32
-
33
-
## Connect to Percona Server for MySQL from the command line client
23
+
## Connect to MariaDB from the MySQL command line client
34
24
35
25
The following command starts another `%%IMAGE%%` container instance and runs the `mysql` command line client against your original `%%IMAGE%%` container, allowing you to execute SQL statements against your database instance:
36
26
37
27
```console
38
-
$ docker run -it --link some-%%REPO%%:mysql --rm %%IMAGE%% sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'
28
+
$ docker run -it --network some-network --rm %%IMAGE%% mysql -hsome-%%REPO%% -uexample-user -p
39
29
```
40
30
41
-
... where `some-%%REPO%%` is the name of your original `%%IMAGE%%` container.
31
+
... where `some-%%REPO%%` is the name of your original `%%IMAGE%%` container (connected to the `some-network` Docker network).
42
32
43
33
This image can also be used as a client for non-Docker or remote instances:
0 commit comments