Docker Community Forums

Share and learn in the Docker community.

Docker cassandra with opscenter unable connected

docker

(Lighterlai) #1

I want to create 3 cassandra with 1 opscenter. This is my docker-compose.yml

version: '2'
services:
    cassandra-1:
        image: cassandra
        container_name: cassandra-1
        environment:
            CASSANDRA_BROADCAST_ADDRESS: "cassandra-1"
        ports:
            - 7000
            - 9160:9160
            - 9042:9042
            - 7199:7199
        volumes:
            - "./test_vol_1/:/var/lib/cassandra"
        restart: always

    cassandra-2:
        image: cassandra
        container_name: cassandra-2
        environment:
            CASSANDRA_BROADCAST_ADDRESS: "cassandra-2"
            CASSANDRA_SEEDS: "cassandra-1"
        ports:
            - 7000
        depends_on:
            - cassandra-1
        volumes:
            - "./test_vol_2/:/var/lib/cassandra"

    cassandra-3:
        image: cassandra
        container_name: cassandra-3
        environment:
            CASSANDRA_BROADCAST_ADDRESS: "cassandra-3"
            CASSANDRA_SEEDS: "cassandra-1"
        ports:
            - 7000
        depends_on:
            - cassandra-1
        volumes:
            - "./test_vol_3/:/var/lib/cassandra"

    opscenter:
        image: poklet/opscenter
        container_name: opscenter
        links:
            - cassandra-1
        ports:
            - "8888:8888"

And I start up, $ docker-compose up -d. It work. And I try to use nodetool status on my cassandra-1.

$ docker exec -it cassandra-1 bash

root@f2da4dfc0c1b:/# nodetool status
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address     Load       Tokens       Owns (effective)  Host ID                               Rack
UN  172.18.0.2  265.47 KiB  256          64.7%             4c825ccc-71bb-4a17-8000-a3c8fc6cb703  rack1
UN  172.18.0.3  209.88 KiB  256          67.6%             08f50dc6-22e1-4038-b195-0b29e8075b03  rack1
UN  172.18.0.4  230.39 KiB  256          67.7%             1aed5f9a-9ce6-4543-a9d2-13bb58633c98  rack1

And then I open http://127.0.0.1:8888 on my host browser. And I click Manage Existing cluster. I type the ip address (127.0.0.1, localhost). I got the message.

Error creating cluster: Unable to connect to cluster. Error is: Unable to connect to any servers

I founded my cassandra-1 IP address is empty.

$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' cassandra-1

Thanks your help. :slight_smile: