Невозможно подключиться к более чем одному узлу в кластере - PullRequest
0 голосов
/ 31 марта 2020

У меня есть это приложение Spring Boot, которое отлично работает с Cassandra, когда работает только один узел (docker). Когда я добавляю к нему другой узел в docker, он формирует кластер и не может подключиться к добавленному узлу.

Вставленные данные по-прежнему реплицируются на другой узел в серверной части Cassandra, но из-за этого я не может добавить второй узел как cassandra.contact.point к Spring. Не имея второго узла в качестве точки контакта, он по-прежнему имеет единственную точку отказа, и это как бы разрушает саму идею использования Кассандры (так как я планирую добавить больше узлов в будущем). Вот скриншот статуса nodetool:
nodetool status

Я надеюсь, что кто-то знает, как это исправить.

2020-03-31 15:10:54.142  INFO 13488 --- [           main] g.s.SpringBootCassandraApplication       : Starting SpringBootCassandraApplication on DESKTOP-VMDG4UP with PID 13488 (started by mpdek in D:\Fontys\Semester 6\oefenrepo\spring-boot-cassandra-example)
2020-03-31 15:10:54.149  INFO 13488 --- [           main] g.s.SpringBootCassandraApplication       : No active profile set, falling back to default profiles: default
2020-03-31 15:10:54.267  INFO 13488 --- [           main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@38c5cc4c: startup date [Tue Mar 31 15:10:54 CEST 2020]; root of context hierarchy
2020-03-31 15:10:55.607  INFO 13488 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'cassandraTemplate' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=cassandraConfig; factoryMethodName=cassandraTemplate; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [guru/springframework/config/CassandraConfig.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration; factoryMethodName=cassandraTemplate; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfiguration.class]]
2020-03-31 15:10:56.511  INFO 13488 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2020-03-31 15:10:56.543  INFO 13488 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2020-03-31 15:10:56.544  INFO 13488 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.28
2020-03-31 15:10:56.554  INFO 13488 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jdk1.8.0_181\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\apache-maven-3.6.0\bin;C:\PROGRA~1\Java\JDK18~1.0_1\bin;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\WINDOWS\System32\OpenSSH\;C:\OpenSSL-Win32\bin;C:\Users\mpdek\AppData\Local\Microsoft\WindowsApps;C:\Users\mpdek\AppData\Roaming\npm;C:\Users\mpdek\AppData\Local\atom\bin;C:\Program Files\nodejs\;C:\Program Files\PuTTY\;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Oracle\VirtualBox\;;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;"C:\apache-maven-3.6.0\bin;";C:\Users\mpdek\AppData\Local\Microsoft\WindowsApps;C:\Users\mpdek\AppData\Local\atom\bin;C:\Users\mpdek\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files (x86)\Nmap;"C:\PROGRA~1\Java\JDK18~1.0_1\bin;C:\Users\mpdek\AppData\Roaming\npm;C:\Users\mpdek\AppData\Local\Microsoft\WindowsApps;C:\OpenSSL-Win64\bin;C:\Program Files\Oracle\VirtualBox\;;.]
2020-03-31 15:10:56.746  INFO 13488 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2020-03-31 15:10:56.746  INFO 13488 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2479 ms
2020-03-31 15:10:56.920  INFO 13488 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Servlet dispatcherServlet mapped to [/]
2020-03-31 15:10:56.926  INFO 13488 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2020-03-31 15:10:56.927  INFO 13488 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2020-03-31 15:10:56.927  INFO 13488 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2020-03-31 15:10:56.927  INFO 13488 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2020-03-31 15:10:57.091  INFO 13488 --- [           main] c.d.driver.core.GuavaCompatibility       : Detected Guava >= 19 in the classpath, using modern compatibility layer
2020-03-31 15:10:57.255  INFO 13488 --- [           main] com.datastax.driver.core.Native          : Could not load JNR C Library, native system calls through this library will not be available (set this logger level to DEBUG to see the full stack trace).
2020-03-31 15:10:57.255  INFO 13488 --- [           main] com.datastax.driver.core.ClockFactory    : Using java.lang.System clock to generate timestamps.
2020-03-31 15:10:57.359  INFO 13488 --- [           main] com.datastax.driver.core.NettyUtil       : Did not find Netty's native epoll transport in the classpath, defaulting to NIO.
2020-03-31 15:10:58.676  WARN 13488 --- [           main] com.datastax.driver.core.Cluster         : You listed localhost/127.0.0.1:9042 in your contact points, but it wasn't found in the control host's system.peers at startup
2020-03-31 15:10:58.910  INFO 13488 --- [           main] c.d.d.c.p.DCAwareRoundRobinPolicy        : Using data-center name 'datacenter1' for DCAwareRoundRobinPolicy (if this is incorrect, please provide the correct datacenter name with DCAwareRoundRobinPolicy constructor)
2020-03-31 15:10:58.916  INFO 13488 --- [           main] com.datastax.driver.core.Cluster         : New Cassandra host localhost/0:0:0:0:0:0:0:1:9042 added
2020-03-31 15:10:58.916  INFO 13488 --- [           main] com.datastax.driver.core.Cluster         : New Cassandra host /172.17.0.3:9042 added
2020-03-31 15:11:03.956  WARN 13488 --- [er-nio-worker-2] c.d.driver.core.HostConnectionPool       : Error creating connection to /172.17.0.3:9042

com.datastax.driver.core.exceptions.TransportException: [/172.17.0.3:9042] Cannot connect
    at com.datastax.driver.core.Connection$1.operationComplete(Connection.java:167) [cassandra-driver-core-3.4.0.jar:na]
    at com.datastax.driver.core.Connection$1.operationComplete(Connection.java:150) [cassandra-driver-core-3.4.0.jar:na]
    at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:511) [netty-common-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:504) [netty-common-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:483) [netty-common-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:424) [netty-common-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:121) [netty-common-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe$1.run(AbstractNioChannel.java:269) [netty-transport-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.util.concurrent.PromiseTask$RunnableAdapter.call(PromiseTask.java:38) [netty-common-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:125) [netty-common-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) [netty-common-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404) [netty-common-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463) [netty-transport-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886) [netty-common-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-common-4.1.22.Final.jar:4.1.22.Final]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_181]
Caused by: io.netty.channel.ConnectTimeoutException: connection timed out: /172.17.0.3:9042
    at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe$1.run(AbstractNioChannel.java:267) [netty-transport-4.1.22.Final.jar:4.1.22.Final]
    ... 8 common frames omitted

2020-03-31 15:11:03.958  WARN 13488 --- [er-nio-worker-2] com.datastax.driver.core.Session         : Error creating pool to /172.17.0.3:9042

com.datastax.driver.core.exceptions.ConnectionException: [/172.17.0.3:9042] Pool was closed during initialization
    at com.datastax.driver.core.HostConnectionPool$2.onSuccess(HostConnectionPool.java:148) [cassandra-driver-core-3.4.0.jar:na]
    at com.datastax.driver.core.HostConnectionPool$2.onSuccess(HostConnectionPool.java:134) [cassandra-driver-core-3.4.0.jar:na]
    at com.google.common.util.concurrent.Futures$6.run(Futures.java:1773) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:456) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:817) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:753) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:613) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.CollectionFuture$CollectionFutureRunningState.handleAllCompleted(CollectionFuture.java:76) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.AggregateFuture$RunningState.processCompleted(AggregateFuture.java:255) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.AggregateFuture$RunningState.decrementCountAndMaybeComplete(AggregateFuture.java:242) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.AggregateFuture$RunningState.access$300(AggregateFuture.java:91) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.AggregateFuture$RunningState$1.run(AggregateFuture.java:146) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:456) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:817) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:753) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.AbstractFuture.completeWithFuture(AbstractFuture.java:730) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.AbstractFuture.setFuture(AbstractFuture.java:666) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.Futures$AsyncCatchingFuture.doFallback(Futures.java:826) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.Futures$AsyncCatchingFuture.doFallback(Futures.java:813) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.Futures$AbstractCatchingFuture.run(Futures.java:789) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:456) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:817) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:753) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.AbstractFuture.completeWithFuture(AbstractFuture.java:730) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.AbstractFuture.setFuture(AbstractFuture.java:666) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.Futures$AsyncCatchingFuture.doFallback(Futures.java:826) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.Futures$AsyncCatchingFuture.doFallback(Futures.java:813) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.Futures$AbstractCatchingFuture.run(Futures.java:789) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:456) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:817) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:753) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:634) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.Futures$AbstractChainingFuture.run(Futures.java:1405) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:456) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:817) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:753) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:634) [guava-19.0.jar:na]
    at com.google.common.util.concurrent.SettableFuture.setException(SettableFuture.java:53) [guava-19.0.jar:na]
    at com.datastax.driver.core.Connection$1.operationComplete(Connection.java:167) [cassandra-driver-core-3.4.0.jar:na]
    at com.datastax.driver.core.Connection$1.operationComplete(Connection.java:150) [cassandra-driver-core-3.4.0.jar:na]
    at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:511) [netty-common-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:504) [netty-common-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:483) [netty-common-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:424) [netty-common-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:121) [netty-common-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe$1.run(AbstractNioChannel.java:269) [netty-transport-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.util.concurrent.PromiseTask$RunnableAdapter.call(PromiseTask.java:38) [netty-common-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:125) [netty-common-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) [netty-common-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404) [netty-common-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463) [netty-transport-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886) [netty-common-4.1.22.Final.jar:4.1.22.Final]
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-common-4.1.22.Final.jar:4.1.22.Final]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_181]

2020-03-31 15:11:04.807  INFO 13488 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@38c5cc4c: startup date [Tue Mar 31 15:10:54 CEST 2020]; root of context hierarchy
2020-03-31 15:11:04.896  INFO 13488 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/tweet/{id}/{tweet}],methods=[GET]}" onto public java.lang.Boolean guru.springframework.controllers.TweetController.saveOrUpdateProduct(java.util.UUID,java.lang.String)
2020-03-31 15:11:04.902  INFO 13488 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2020-03-31 15:11:04.903  INFO 13488 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2020-03-31 15:11:04.948  INFO 13488 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2020-03-31 15:11:04.948  INFO 13488 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2020-03-31 15:11:04.993  INFO 13488 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2020-03-31 15:11:05.029  WARN 13488 --- [           main] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)
2020-03-31 15:11:05.340  INFO 13488 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2020-03-31 15:11:05.384  INFO 13488 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2020-03-31 15:11:05.387  INFO 13488 --- [           main] g.s.SpringBootCassandraApplication       : Started SpringBootCassandraApplication in 11.896 seconds (JVM running for 13.822)
...