-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Ditch a lot of "--link" examples (using "--network some-network" instead to force users to do more homework) #1441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -18,14 +18,6 @@ $ docker run --name some-%%REPO%% -d %%IMAGE%%:tag | |||||
|
||||||
... 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. | ||||||
|
||||||
## Connect to Cassandra from an application in another Docker container | ||||||
|
||||||
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: | ||||||
|
||||||
```console | ||||||
$ docker run --name some-app --link some-%%REPO%%:%%REPO%% -d app-that-uses-cassandra | ||||||
``` | ||||||
|
||||||
## Make a cluster | ||||||
|
||||||
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. | ||||||
|
@@ -36,10 +28,10 @@ $ docker run --name some-%%REPO%%2 -d -e CASSANDRA_SEEDS="$(docker inspect --for | |||||
|
||||||
... 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. | ||||||
|
||||||
Or you may use the docker run --link option to tell the new node where the first is: | ||||||
Or you may use Docker networks to tell the new node where the first is: | ||||||
|
||||||
```console | ||||||
$ docker run --name some-cassandra2 -d --link some-cassandra:cassandra %%IMAGE%%:tag | ||||||
$ docker run --name some-cassandra2 -d --network some-network %%IMAGE%%:tag | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line won't create a cluster now; using link was correct, since cassandra took advantage of the link variables (https://github.com/docker-library/cassandra/blob/386357f2c90e5a53ad26f610cdc0eb001a67e9f0/3.11/docker-entrypoint.sh#L54-L56). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
``` | ||||||
|
||||||
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). | ||||||
|
@@ -61,17 +53,9 @@ $ docker run --name some-%%REPO%% -d -e CASSANDRA_BROADCAST_ADDRESS=10.43.43.43 | |||||
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: | ||||||
|
||||||
```console | ||||||
$ docker run -it --link some-%%REPO%%:cassandra --rm %%IMAGE%% sh -c 'exec cqlsh "$CASSANDRA_PORT_9042_TCP_ADDR"' | ||||||
$ docker run -it --network some-network --rm %%IMAGE%% cqlsh some-cassandra | ||||||
``` | ||||||
|
||||||
... or (simplified to take advantage of the `/etc/hosts` entry Docker adds for linked containers): | ||||||
|
||||||
```console | ||||||
$ docker run -it --link some-%%REPO%%:cassandra --rm %%IMAGE%% cqlsh cassandra | ||||||
``` | ||||||
|
||||||
... where `some-%%REPO%%` is the name of your original Cassandra Server container. | ||||||
|
||||||
More information about the CQL can be found in the [Cassandra documentation](https://cassandra.apache.org/doc/latest/cql/index.html). | ||||||
|
||||||
## Container shell access and viewing Cassandra logs | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.