Hello David,

 - 1. Does the `cassandra` DNS entry within the James container resolves
to Cassandra? (this can be achieved with links or network).

 - 2. A restarting Cassandra (with many data in the commitlog) might
reject clients. Monitor Cassandra logs to check if this happens.

I also noticed you used an unoffical image for Cassandra. Could this be
a cause for your issue? Are you sure cassandra is well started after
your configuration modifications?

Cheers,

Benoit

On 28/10/2019 13:07, David Leangen wrote:
> 
> Hi!
> 
> I am sure the problem is due to my inexperience with Docker and Cassandra, 
> and even more so networking between multiple Docker containers… but I have 
> tried everything I can think of and would like to ask for some help. 😅
> 
> I am getting this error:
> 
> [root@e5cc3846b51c apache-james-3.3.0]# java 
> -Dworking.directory=/opt/apache-james-3.3.0 -jar 
> server/container/guice/cassandra-guice/target/james-server-cassandra-guice.jar
> 2019-10-28 05:51:54,981 WARN  [main] - 
> [org.apache.james.modules.mailbox.ResilientClusterProvider]- Error 
> establishing Cassandra connection. Next retry scheduled in PT5S ms
> com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) 
> tried for query failed (tried: /172.17.0.2:9042 
> (com.datastax.driver.core.exceptions.TransportException: [/172.17.0.2:9042] 
> Cannot connect))
> 
> 
> The error is shown when I try to run JAMES from within a Docker container.
> 
> Cassandra is up and running, and ought to be available via the IP address 
> 172.17.0.2, on port 9042.
> 
> [root@james ~]# ip addr
> 1: lo: <SNIP>
> 2: eth0: <SNIP>
> 3: eth1: <SNIP>
> 4: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP 
> group default 
>     link/ether 02:42:76:5f:17:bb brd ff:ff:ff:ff:ff:ff
>     inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
>        valid_lft forever preferred_lft forever
>     inet6 fe80::42:76ff:fe5f:17bb/64 scope link 
>        valid_lft forever preferred_lft forever
> 10: veth81426b0@if9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue 
> master docker0 state UP group default 
>     link/ether 1a:70:e2:f3:7e:70 brd ff:ff:ff:ff:ff:ff link-netnsid 0
>     inet6 fe80::1870:e2ff:fef3:7e70/64 scope link 
>        valid_lft forever preferred_lft forever
> 12: vethc13d660@if11: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc 
> noqueue master docker0 state UP group default 
>     link/ether 5a:fd:2d:ad:df:12 brd ff:ff:ff:ff:ff:ff link-netnsid 1
>     inet6 fe80::58fd:2dff:fead:df12/64 scope link 
>        valid_lft forever preferred_lft forever
> 
> The two virtual ethernet ports are for the james and cassandra containers.
> 
> Here is the run command for cassandra:
> 
> docker run \
>   -dit \
>   -v /home/cassandra/conf:/opt/cassandra/latest/conf \
>   -v /home/cassandra/data:/data \
>   -v /home/cassandra/commitlog:/commitlog \
>   -v /home/cassandra/saved_caches:/saved_caches \
>   -v /home/cassandra/hints:/hints \
>   -p 7000:7000 \
>   -p 7001:7001 \
>   -p 7199:7199 \
>   -p 9042:9042 \
>   -p 9160:9160 \
>   --ulimit memlock=-1:-1 \
>   --memory='1g' \
>   --name=cassandra \
>   dleangen/cassandra:3.11.4
> 
> 
> Here is docker ps from the host:
> 
> [root@james ~]# docker ps
> CONTAINER ID        IMAGE                       COMMAND             CREATED   
>           STATUS              PORTS                                           
>                                                            NAMES
> e5cc3846b51c        dleangen/james:3.3.0        "/bin/bash"         7 minutes 
> ago       Up 7 minutes                                                        
>                                                            youthful_pascal
> 1fefe86df493        dleangen/cassandra:3.11.4   "cassandra -f"      9 minutes 
> ago       Up 9 minutes        0.0.0.0:7000-7001->7000-7001/tcp, 
> 0.0.0.0:7199->7199/tcp, 0.0.0.0:9042->9042/tcp, 0.0.0.0:9160->9160/tcp   
> cassandra
> 
> Here is the /etc/hosts file in the Cassandra container:
> 
> bash-4.2$ more /etc/hosts
> 127.0.0.1     localhost
> ::1   localhost ip6-localhost ip6-loopback
> fe00::0       ip6-localnet
> ff00::0       ip6-mcastprefix
> ff02::1       ip6-allnodes
> ff02::2       ip6-allrouters
> 172.17.0.2    1fefe86df493
> 
> 
> Cassandra is up. I tested that it is indeed available from within the Docker 
> container over 127.0.0.1.
> 
> So how the heck do I get my james container to be able to connect to it??
> 
> (I plan to use Docker Compose later… right now I’m trying to just connect my 
> containers directly.)
> 
> 
> Thank you in advance for your help!!! 😇
> 
> Cheers,
> =David
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org

Reply via email to