cassandra异常com.datastax.driver.core.exceptions.nohostavailableexception

ht4b089n  于 2021-06-09  发布在  Cassandra
关注(0)|答案(0)|浏览(258)

当我在gitlab管道中运行此代码时,它会失败,并出现nohostavailableexception错误。在我的家乡很管用。有人能建议我该怎么做才能让它在管道中工作吗?一个猜测是禁用ssl可能?当我在gitlab管道中运行它时,我该怎么做呢?

String serverIp = testConfig.get("serverIp");  
              String keyspace = testConfig.get("keyspace");
              String username = testConfig.get("username"); 
              String password = testConfig.get("password");

              String query = select * from bills where accountnumber='1234567'order by sequencenumber;

              SocketOptions so = new SocketOptions();
              so.setConnectTimeoutMillis(connectionTimeOut);
              so.setReadTimeoutMillis(readTimeOut);

                     Cluster cluster = Cluster.builder().addContactPoint(serverIp).withPort(port).withCredentials(username, password).withSocketOptions(so).build();

                     Session session = cluster.connect(keyspace);

 for (Row row : session.execute(query)) {

              billsequencenumber = row.getInt("sequencenumber"); 
              accountnumber = row.getString("accountnumber"); 

              }

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题