aerospike / aerospike-server.docker

Dockerfiles for Aerospike Server
Other
141 stars 68 forks source link

Cannot assign requested address on container without --net=host #9

Closed theonlydoo closed 8 years ago

theonlydoo commented 8 years ago

Hi, I'm currently running a 4 machines aerospike cluster with docker, each node is on a separate server.

The config

service {
        user root
        group root
        pidfile /var/run/aerospike/asd.pid
        service-threads 8
        transaction-queues 8
        transaction-threads-per-queue 8
        proto-fd-max 15000
}
logging {
        file /var/log/aerospike/aerospike.log {
                context any info
        }
        console {
                context any info
        }
}
network {
        service {
                address any
                port 3000
                access-address 1.2.112.154 virtual
        }
        heartbeat {
                mode mesh
                address 1.2.112.154
                port 3002
                mesh-seed-address-port 1.2.117.54 3002
                interval 150
                timeout 10
        }
        fabric {
                port 3001
        }
        info {
                port 3003
        }
}
namespace test {
        replication-factor 2
        memory-size 100G
        storage-engine device {
                file /opt/aerospike/data/test.dat
                filesize 100G
        }

The issue

Whe we run with

docker run --rm -ti --name aerospike -p 3000:3000 -p 3001:3001 -p 3002:3002 -p 3003:3003 -v /data/ssd/aerospike-db:/opt/aerospike/data -v /home/x/aerospike/conf:/etc/aerospike aerospike/aerospike-server asd --foreground

It appears that aerospike tries to bind 1.2.112.154 as mesh listen address. Since we do not use --net=host, the container is not aware that the host has this address. So the start fails.

Oct 27 2015 13:24:37 GMT: INFO (as): (as.c::415) initializing services...
Oct 27 2015 13:24:37 GMT: INFO (tsvc): (thr_tsvc.c::910) shared queues: 8 queues with 8 threads each
Oct 27 2015 13:24:37 GMT: INFO (hb): (hb.c::2485) heartbeat socket initialization
Oct 27 2015 13:24:37 GMT: INFO (hb): (hb.c::2499) initializing mesh heartbeat socket : 1.2.112.154:3002
Oct 27 2015 13:24:37 GMT: WARNING (cf:socket): (socket.c::245) bind: Cannot assign requested address

Is there clean way to bind the container on the host IP address and not use --net=host ?

psi-mankoski commented 8 years ago

Thanks for the comment. Since the 3.6.2 release, we have supported using the "interface-address" in the "network" > "heartbeat" context for this purpose. Specifically, when using this config. file option, the "asd" process will not actually bind the address, but rather will send it out as the IP address for other nodes to use to send heartbeats back to it. This should allow you to run without host networking.

Please give it a try and let us know if you encounter any issues. Thanks!

theonlydoo commented 8 years ago

Thank you for the details, added into the doc in this PR