2016-11-27 30 views
0

クエリを実行してアプリケーションで使用されるすべてのcassandraテーブルを初期化するJavaアプリケーションがあります。これは、Apache Cassandra 3.3を使用してローカルで、また、リモートのテストサーバーでうまく動作します。しかし、私は3つのノードを持つカサンドラ3.3クラスタでの生産でそれを実行すると、それは最初の22個のテーブルを作成し、エラーテーブルを作成するときにCassandra system_schema keyspaceをユーザーが変更することはできません

ERROR UNAUTHORIZED: system_schema keyspace is not user-modifiable. 

である特定のテーブルで常に停止し、この問題を作るクエリは次のとおりです。

、NOTはuserrecom_newusers(ユーザーID BIGINT、タイムスタンプ BIGINT、PRIMARY KEY(ユーザーID))

を存在し、とは何の関係もありませんので、それは、鍵空間 "prosolo_logs_moocs" を使用している場合のCREATE TABLE system_schema。これらのテーブルを作成します

Javaコードは次のとおりです。

this.createSchemaIfNotExists(this.getSession(), this.dbName, 
       this.dbConfig.replicationFactor); 
     Metadata metadata = this.getCluster().getMetadata(); 
     metadata.getKeyspace(keyspacename).getTables(); 
     this.getSession().execute("USE "+keyspacename); 
     for (String ddl : this.ddls) { 
      try { 
       this.getSession().execute(ddl); 
      } catch (Exception ex) { 
       logger.error("Error during the creation of table:" 
         + keyspacename + " for DDL:" + ddl); 
       ex.printStackTrace(); 
      } 
     } 

フルトレースログは次のとおりです。

TRACE [2016-11-27 06:55:31,313] [localhost-startStop-1] driver.core.RequestHandler (RequestHandler.java:71)  [1154641956] CREATE TABLE IF NOT EXISTS userrecom_newusers(userid bigint, timestamp bigint, PRIMARY KEY (userid)) 
TRACE [2016-11-27 06:55:31,313] [localhost-startStop-1] driver.core.RequestHandler (RequestHandler.java:71)  [1154641956] CREATE TABLE IF NOT EXISTS userrecom_newusers(userid bigint, timestamp bigint, PRIMARY KEY (userid)) 
TRACE [2016-11-27 06:55:31,313] [localhost-startStop-1] driver.core.RequestHandler (RequestHandler.java:272)  [1154641956-1] Starting 
TRACE [2016-11-27 06:55:31,313] [localhost-startStop-1] driver.core.RequestHandler (RequestHandler.java:272)  [1154641956-1] Starting 
TRACE [2016-11-27 06:55:31,313] [localhost-startStop-1] driver.core.RequestHandler (RequestHandler.java:280)  [1154641956-1] Querying node /10.0.0.184:9042 
TRACE [2016-11-27 06:55:31,313] [localhost-startStop-1] driver.core.RequestHandler (RequestHandler.java:280)  [1154641956-1] Querying node /10.0.0.184:9042 
TRACE [2016-11-27 06:55:31,313] [localhost-startStop-1] driver.core.Connection (Connection.java:519)  Connection[/10.0.0.184:9042-2, inFlight=1, closed=false], stream 1088, writing request QUERY CREATE TABLE IF NOT EXISTS userrecom_newusers(userid bigint, timestamp bigint, PRIMARY KEY (userid))([cl=LOCAL_ONE, positionalVals=[], namedVals={}, skip=false, psize=5000, state=null, serialCl=SERIAL]) 
TRACE [2016-11-27 06:55:31,313] [localhost-startStop-1] driver.core.Connection (Connection.java:519)  Connection[/10.0.0.184:9042-2, inFlight=1, closed=false], stream 1088, writing request QUERY CREATE TABLE IF NOT EXISTS userrecom_newusers(userid bigint, timestamp bigint, PRIMARY KEY (userid))([cl=LOCAL_ONE, positionalVals=[], namedVals={}, skip=false, psize=5000, state=null, serialCl=SERIAL]) 
TRACE [2016-11-27 06:55:31,313] [cluster3-nio-worker-3] driver.core.Connection (Connection.java:567)  Connection[/10.0.0.184:9042-2, inFlight=1, closed=false], stream 1088, request sent successfully 
TRACE [2016-11-27 06:55:31,313] [cluster3-nio-worker-3] driver.core.Connection (Connection.java:567)  Connection[/10.0.0.184:9042-2, inFlight=1, closed=false], stream 1088, request sent successfully 
TRACE [2016-11-27 06:55:31,315] [cluster3-nio-worker-3] driver.core.Connection (Connection.java:979)  Connection[/10.0.0.184:9042-2, inFlight=1, closed=false], stream 1088, received: ERROR UNAUTHORIZED: system_schema keyspace is not user-modifiable. 
TRACE [2016-11-27 06:55:31,315] [cluster3-nio-worker-3] driver.core.Connection (Connection.java:979)  Connection[/10.0.0.184:9042-2, inFlight=1, closed=false], stream 1088, received: ERROR UNAUTHORIZED: system_schema keyspace is not user-modifiable. 
TRACE [2016-11-27 06:55:31,316] [cluster3-nio-worker-3] driver.core.RequestHandler (RequestHandler.java:166)  [1154641956-1] Setting final result 
TRACE [2016-11-27 06:55:31,316] [cluster3-nio-worker-3] driver.core.RequestHandler (RequestHandler.java:166)  [1154641956-1] Setting final result 
ERROR [2016-11-27 06:55:31,316] [localhost-startStop-1] cassandra.impl.SimpleCassandraClientImpl (CassandraDDLManagerImpl.java:274)  Error during the creation of table:prosolo_logs_mooc for DDL:CREATE TABLE IF NOT EXISTS userrecom_newusers(userid bigint, timestamp bigint, PRIMARY KEY (userid)) 
com.datastax.driver.core.exceptions.UnauthorizedException: system_schema keyspace is not user-modifiable. 
    at com.datastax.driver.core.exceptions.UnauthorizedException.copy(UnauthorizedException.java:59) 
    at com.datastax.driver.core.exceptions.UnauthorizedException.copy(UnauthorizedException.java:25) 
    at com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:37) 
    at com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:245) 
    at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:63) 
    at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:39) 
    at org.prosolo.bigdata.dal.cassandra.impl.CassandraDDLManagerImpl.checkIfTablesExistsAndCreate(CassandraDDLManagerImpl.java:272) 
    at org.prosolo.bigdata.dal.cassandra.impl.CassandraDDLManagerImpl.<init>(CassandraDDLManagerImpl.java:39) 
    at org.prosolo.bigdata.dal.cassandra.impl.CassandraDDLManagerImpl.<init>(CassandraDDLManagerImpl.java:23) 
    at org.prosolo.bigdata.dal.cassandra.impl.CassandraDDLManagerImpl$CassandraDDLManagerImplHolder.<clinit>(CassandraDDLManagerImpl.java:44) 
    at org.prosolo.bigdata.dal.cassandra.impl.CassandraDDLManagerImpl.getInstance(CassandraDDLManagerImpl.java:47) 
    at org.prosolo.bigdata.app.ContextLoader.contextInitialized(ContextLoader.java:40) 
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4842) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) 
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725) 
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701) 
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) 
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:940) 
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1816) 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
    at java.lang.Thread.run(Thread.java:745) 
Caused by: com.datastax.driver.core.exceptions.UnauthorizedException: system_schema keyspace is not user-modifiable. 
    at com.datastax.driver.core.Responses$Error.asException(Responses.java:134) 
    at com.datastax.driver.core.DefaultResultSetFuture.onSet(DefaultResultSetFuture.java:179) 
    at com.datastax.driver.core.RequestHandler.setFinalResult(RequestHandler.java:184) 
    at com.datastax.driver.core.RequestHandler.access$2500(RequestHandler.java:43) 
    at com.datastax.driver.core.RequestHandler$SpeculativeExecution.setFinalResult(RequestHandler.java:798) 
    at com.datastax.driver.core.RequestHandler$SpeculativeExecution.onSet(RequestHandler.java:617) 
    at com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:1005) 
    at com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:928) 
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) 
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318) 
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304) 
    at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:266) 
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318) 
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304) 
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) 
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318) 
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304) 
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:276) 
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:263) 
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318) 
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304) 
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846) 
    at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:831) 
    at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:346) 
    at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:254) 
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) 
    ... 1 more 

このクエリはDatastax DevCenterから細かい実行されます。私はdatastax cassandraドライバ3.0.0を使用しています。

何が問題なのでしょうか?

UPDATE:私は変更のカップルを作った後、私は今、例外

Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table logevents 

を取得しています

public void connect(String node, int dbPort, String keyspace, int replicationFactor) { 
    System.out.println("CONNECTING CASSANDRA:"+node+" keyspace:"+keyspace); 
    if (this.session != null) { 
     return; 
    } 
    if (this.cluster != null) { 
     return; 
    } 
    /*cluster = Cluster.builder().addContactPoint(node).build();*/ 
    this.cluster = Cluster.builder() 
      .withPoolingOptions(getPoolingOptions()) 
      .withRetryPolicy(DowngradingConsistencyRetryPolicy.INSTANCE) 
      .withReconnectionPolicy(new ConstantReconnectionPolicy(100L)) 
      .withPort(dbPort) 
      .addContactPoint(node).build(); 
    Metadata metadata = cluster.getMetadata(); 
    System.out.printf("Connected to cluster: %s\n", 
      metadata.getClusterName()); 
    for (Host host : metadata.getAllHosts()) { 
     System.out.printf("Datacenter: %s; Host: %s; Rack: %s\n", 
       host.getDatacenter(), host.getAddress(), host.getRack()); 
    } 
    if (keyspace != null) { 
     try { 
      this.session = this.cluster.connect(keyspace); 
     } catch (InvalidQueryException iqu) { 
      logger.error(iqu); 
      this.session = this.cluster.connect(); 
      this.createSchemaIfNotExists(this.session, keyspace, 
        replicationFactor); 
     } 
    } else { 
     this.session = this.cluster.connect(); 
    } 
    this.session.execute("USE "+keyspace); 
} 

これは私がクラスタに接続するために使用しているコードがありますエラーログ全体:

TRACE [2016-11-27 20:09:08,775] [localhost-startStop-1] driver.core.RequestHandler (RequestHandler.java:72)  [1994318425] USE prosolo_logs_mooc 
TRACE [2016-11-27 20:09:08,775] [localhost-startStop-1] driver.core.RequestHandler (RequestHandler.java:72)  [1994318425] USE prosolo_logs_mooc 
TRACE [2016-11-27 20:09:08,775] [localhost-startStop-1] driver.core.RequestHandler (RequestHandler.java:262)  [1994318425-1] Starting 
TRACE [2016-11-27 20:09:08,775] [localhost-startStop-1] driver.core.RequestHandler (RequestHandler.java:262)  [1994318425-1] Starting 
TRACE [2016-11-27 20:09:08,775] [localhost-startStop-1] driver.core.RequestHandler (RequestHandler.java:270)  [1994318425-1] Querying node /10.0.0.182:9042 
TRACE [2016-11-27 20:09:08,775] [localhost-startStop-1] driver.core.RequestHandler (RequestHandler.java:270)  [1994318425-1] Querying node /10.0.0.182:9042 
TRACE [2016-11-27 20:09:08,775] [localhost-startStop-1] driver.core.Connection (Connection.java:472)  Connection[/10.0.0.182:9042-1, inFlight=1, closed=false] Setting keyspace prosolo_logs_mooc 
TRACE [2016-11-27 20:09:08,775] [localhost-startStop-1] driver.core.Connection (Connection.java:472)  Connection[/10.0.0.182:9042-1, inFlight=1, closed=false] Setting keyspace prosolo_logs_mooc 
TRACE [2016-11-27 20:09:08,776] [localhost-startStop-1] driver.core.Connection (Connection.java:532)  Connection[/10.0.0.182:9042-1, inFlight=1, closed=false], stream 384, writing request QUERY USE "prosolo_logs_mooc"([cl=ONE, positionalVals=[], namedVals={}, skip=false, psize=-1, state=null, serialCl=SERIAL]) 
TRACE [2016-11-27 20:09:08,776] [localhost-startStop-1] driver.core.Connection (Connection.java:532)  Connection[/10.0.0.182:9042-1, inFlight=1, closed=false], stream 384, writing request QUERY USE "prosolo_logs_mooc"([cl=ONE, positionalVals=[], namedVals={}, skip=false, psize=-1, state=null, serialCl=SERIAL]) 
TRACE [2016-11-27 20:09:08,776] [cluster3-nio-worker-1] driver.core.Connection (Connection.java:580)  Connection[/10.0.0.182:9042-1, inFlight=1, closed=false], stream 384, request sent successfully 
TRACE [2016-11-27 20:09:08,776] [cluster3-nio-worker-1] driver.core.Connection (Connection.java:580)  Connection[/10.0.0.182:9042-1, inFlight=1, closed=false], stream 384, request sent successfully 
TRACE [2016-11-27 20:09:08,776] [cluster3-nio-worker-1] driver.core.Connection (Connection.java:986)  Connection[/10.0.0.182:9042-1, inFlight=1, closed=false], stream 384, received: RESULT set keyspace prosolo_logs_mooc 
TRACE [2016-11-27 20:09:08,776] [cluster3-nio-worker-1] driver.core.Connection (Connection.java:986)  Connection[/10.0.0.182:9042-1, inFlight=1, closed=false], stream 384, received: RESULT set keyspace prosolo_logs_mooc 
TRACE [2016-11-27 20:09:08,777] [localhost-startStop-1] driver.core.Connection (Connection.java:532)  Connection[/10.0.0.182:9042-1, inFlight=1, closed=false], stream 448, writing request QUERY USE prosolo_logs_mooc([cl=LOCAL_ONE, positionalVals=[], namedVals={}, skip=false, psize=5000, state=null, serialCl=SERIAL]) 
TRACE [2016-11-27 20:09:08,777] [localhost-startStop-1] driver.core.Connection (Connection.java:532)  Connection[/10.0.0.182:9042-1, inFlight=1, closed=false], stream 448, writing request QUERY USE prosolo_logs_mooc([cl=LOCAL_ONE, positionalVals=[], namedVals={}, skip=false, psize=5000, state=null, serialCl=SERIAL]) 
TRACE [2016-11-27 20:09:08,777] [cluster3-nio-worker-1] driver.core.Connection (Connection.java:580)  Connection[/10.0.0.182:9042-1, inFlight=1, closed=false], stream 448, request sent successfully 
TRACE [2016-11-27 20:09:08,777] [cluster3-nio-worker-1] driver.core.Connection (Connection.java:580)  Connection[/10.0.0.182:9042-1, inFlight=1, closed=false], stream 448, request sent successfully 
TRACE [2016-11-27 20:09:08,777] [cluster3-nio-worker-1] driver.core.Connection (Connection.java:986)  Connection[/10.0.0.182:9042-1, inFlight=1, closed=false], stream 448, received: RESULT set keyspace prosolo_logs_mooc 
TRACE [2016-11-27 20:09:08,777] [cluster3-nio-worker-1] driver.core.Connection (Connection.java:986)  Connection[/10.0.0.182:9042-1, inFlight=1, closed=false], stream 448, received: RESULT set keyspace prosolo_logs_mooc 
TRACE [2016-11-27 20:09:08,778] [cluster3-nio-worker-1] driver.core.RequestHandler (RequestHandler.java:156)  [1994318425-1] Setting final result 
TRACE [2016-11-27 20:09:08,778] [cluster3-nio-worker-1] driver.core.RequestHandler (RequestHandler.java:156)  [1994318425-1] Setting final result 
TRACE [2016-11-27 20:09:08,778] [localhost-startStop-1] driver.core.RequestHandler (RequestHandler.java:72)  [1035879214] CREATE INDEX IF NOT EXISTS eventtype_id ON logevents (eventtype); 
TRACE [2016-11-27 20:09:08,778] [localhost-startStop-1] driver.core.RequestHandler (RequestHandler.java:72)  [1035879214] CREATE INDEX IF NOT EXISTS eventtype_id ON logevents (eventtype); 
TRACE [2016-11-27 20:09:08,778] [localhost-startStop-1] driver.core.RequestHandler (RequestHandler.java:262)  [1035879214-1] Starting 
TRACE [2016-11-27 20:09:08,778] [localhost-startStop-1] driver.core.RequestHandler (RequestHandler.java:262)  [1035879214-1] Starting 
TRACE [2016-11-27 20:09:08,778] [localhost-startStop-1] driver.core.RequestHandler (RequestHandler.java:270)  [1035879214-1] Querying node /10.0.0.183:9042 
TRACE [2016-11-27 20:09:08,778] [localhost-startStop-1] driver.core.RequestHandler (RequestHandler.java:270)  [1035879214-1] Querying node /10.0.0.183:9042 
TRACE [2016-11-27 20:09:08,778] [localhost-startStop-1] driver.core.Connection (Connection.java:472)  Connection[/10.0.0.183:9042-1, inFlight=1, closed=false] Setting keyspace prosolo_logs_mooc 
TRACE [2016-11-27 20:09:08,778] [localhost-startStop-1] driver.core.Connection (Connection.java:472)  Connection[/10.0.0.183:9042-1, inFlight=1, closed=false] Setting keyspace prosolo_logs_mooc 
TRACE [2016-11-27 20:09:08,778] [localhost-startStop-1] driver.core.Connection (Connection.java:532)  Connection[/10.0.0.183:9042-1, inFlight=1, closed=false], stream 384, writing request QUERY USE "prosolo_logs_mooc"([cl=ONE, positionalVals=[], namedVals={}, skip=false, psize=-1, state=null, serialCl=SERIAL]) 
TRACE [2016-11-27 20:09:08,778] [localhost-startStop-1] driver.core.Connection (Connection.java:532)  Connection[/10.0.0.183:9042-1, inFlight=1, closed=false], stream 384, writing request QUERY USE "prosolo_logs_mooc"([cl=ONE, positionalVals=[], namedVals={}, skip=false, psize=-1, state=null, serialCl=SERIAL]) 
TRACE [2016-11-27 20:09:08,779] [cluster3-nio-worker-2] driver.core.Connection (Connection.java:580)  Connection[/10.0.0.183:9042-1, inFlight=1, closed=false], stream 384, request sent successfully 
TRACE [2016-11-27 20:09:08,779] [cluster3-nio-worker-2] driver.core.Connection (Connection.java:580)  Connection[/10.0.0.183:9042-1, inFlight=1, closed=false], stream 384, request sent successfully 
TRACE [2016-11-27 20:09:08,779] [cluster3-nio-worker-2] driver.core.Connection (Connection.java:986)  Connection[/10.0.0.183:9042-1, inFlight=1, closed=false], stream 384, received: RESULT set keyspace prosolo_logs_mooc 
TRACE [2016-11-27 20:09:08,779] [cluster3-nio-worker-2] driver.core.Connection (Connection.java:986)  Connection[/10.0.0.183:9042-1, inFlight=1, closed=false], stream 384, received: RESULT set keyspace prosolo_logs_mooc 
TRACE [2016-11-27 20:09:08,780] [localhost-startStop-1] driver.core.Connection (Connection.java:532)  Connection[/10.0.0.183:9042-1, inFlight=1, closed=false], stream 448, writing request QUERY CREATE INDEX IF NOT EXISTS eventtype_id ON logevents (eventtype);([cl=LOCAL_ONE, positionalVals=[], namedVals={}, skip=false, psize=5000, state=null, serialCl=SERIAL]) 
TRACE [2016-11-27 20:09:08,780] [localhost-startStop-1] driver.core.Connection (Connection.java:532)  Connection[/10.0.0.183:9042-1, inFlight=1, closed=false], stream 448, writing request QUERY CREATE INDEX IF NOT EXISTS eventtype_id ON logevents (eventtype);([cl=LOCAL_ONE, positionalVals=[], namedVals={}, skip=false, psize=5000, state=null, serialCl=SERIAL]) 
TRACE [2016-11-27 20:09:08,780] [cluster3-nio-worker-2] driver.core.Connection (Connection.java:580)  Connection[/10.0.0.183:9042-1, inFlight=1, closed=false], stream 448, request sent successfully 
TRACE [2016-11-27 20:09:08,780] [cluster3-nio-worker-2] driver.core.Connection (Connection.java:580)  Connection[/10.0.0.183:9042-1, inFlight=1, closed=false], stream 448, request sent successfully 
TRACE [2016-11-27 20:09:08,781] [cluster3-nio-worker-2] driver.core.Connection (Connection.java:986)  Connection[/10.0.0.183:9042-1, inFlight=1, closed=false], stream 448, received: ERROR INVALID: unconfigured table logevents 
TRACE [2016-11-27 20:09:08,781] [cluster3-nio-worker-2] driver.core.Connection (Connection.java:986)  Connection[/10.0.0.183:9042-1, inFlight=1, closed=false], stream 448, received: ERROR INVALID: unconfigured table logevents 
TRACE [2016-11-27 20:09:08,781] [cluster3-nio-worker-2] driver.core.RequestHandler (RequestHandler.java:156)  [1035879214-1] Setting final result 
TRACE [2016-11-27 20:09:08,781] [cluster3-nio-worker-2] driver.core.RequestHandler (RequestHandler.java:156)  [1035879214-1] Setting final result 
ERROR [2016-11-27 20:09:08,782] [localhost-startStop-1] cassandra.impl.SimpleCassandraClientImpl (CassandraDDLManagerImpl.java:274)  Error during the creation of table:prosolo_logs_mooc for DDL:CREATE INDEX IF NOT EXISTS eventtype_id ON logevents (eventtype); 
com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table logevents 
    at com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java:50) 
    at com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:37) 
    at com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:245) 
    at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:64) 
    at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:39) 
    at org.prosolo.bigdata.dal.cassandra.impl.CassandraDDLManagerImpl.checkIfTablesExistsAndCreate(CassandraDDLManagerImpl.java:272) 
    at org.prosolo.bigdata.dal.cassandra.impl.CassandraDDLManagerImpl.<init>(CassandraDDLManagerImpl.java:39) 
    at org.prosolo.bigdata.dal.cassandra.impl.CassandraDDLManagerImpl.<init>(CassandraDDLManagerImpl.java:23) 
    at org.prosolo.bigdata.dal.cassandra.impl.CassandraDDLManagerImpl$CassandraDDLManagerImplHolder.<clinit>(CassandraDDLManagerImpl.java:44) 
    at org.prosolo.bigdata.dal.cassandra.impl.CassandraDDLManagerImpl.getInstance(CassandraDDLManagerImpl.java:47) 
    at org.prosolo.bigdata.app.ContextLoader.contextInitialized(ContextLoader.java:40) 
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4842) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) 
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725) 
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701) 
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) 
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:940) 
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1816) 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
    at java.lang.Thread.run(Thread.java:745) 
Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table logevents 
    at com.datastax.driver.core.Responses$Error.asException(Responses.java:136) 
    at com.datastax.driver.core.DefaultResultSetFuture.onSet(DefaultResultSetFuture.java:179) 
    at com.datastax.driver.core.RequestHandler.setFinalResult(RequestHandler.java:174) 
    at com.datastax.driver.core.RequestHandler.access$2600(RequestHandler.java:43) 
    at com.datastax.driver.core.RequestHandler$SpeculativeExecution.setFinalResult(RequestHandler.java:793) 
    at com.datastax.driver.core.RequestHandler$SpeculativeExecution.onSet(RequestHandler.java:627) 
    at com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:1012) 
    at com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:935) 
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) 
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) 
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:328) 
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:321) 
    at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:266) 
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) 
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:328) 
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:321) 
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) 
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) 
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:328) 
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:321) 
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293) 
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267) 
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) 
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:328) 
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:321) 
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1280) 
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) 
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:328) 
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:890) 
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131) 
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:564) 
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:505) 
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:419) 
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:391) 
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) 
    ... 1 more 
TRACE [2016-11-27 20:09:08,783] [localhost-startStop-1] driver.core.RequestHandler (RequestHandler.java:72)  [1037500672] USE prosolo_logs_mooc 

更新2:

私が持っていたすべての問題は、適切に構成されていないクラスタに関連しているようです。 nodetoolの状態がすべてのノードが接続されていることが示されていても、一部のノードに到達できず、スキーマの不一致がありました。これらの問題を修正した後は、すべてうまくいきました。 Javaで動作するコードはここ

+0

どのように23'rdテーブルの外観を作成するためのあなたのCQL?あなたはsystem_schemasを手動で変更するはずがないので、cassandraはそれらをあなたのために保守します。 –

答えて

0

です:

public static void main(String[] args) { 
    try (Cluster cluster = Cluster.builder().addContactPoints("127.0.0.1").withCredentials("username", "password").build(); Session session = cluster.connect("test")) { 
     createTableIfNotExist(cluster, session, "test"); 
    } 
} 

private static void createTableIfNotExist(Cluster cluster, Session session, String keyspace) { 
    Metadata metadata = cluster.getMetadata(); 
    TableMetadata tableMetadata = metadata.getKeyspace(keyspace).getTable("exp"); 
    if (tableMetadata == null) { 
     session.execute("USE " + keyspace); 
     session.execute("CREATE TABLE exp(a int primary key, b int)"); 
    } 
} 
+0

これは何も変わりません。私はUSEのキースペースをCREATE TABLEのクエリの前に追加しましたが、それはまだ起こっていますが、他のテーブルでは今起こっています。 –

+0

cluster.connect( "keyspace_name")のように接続するときは、キー空間名を使用してください。 –

+0

私はそれを使用しています。ちょうどキースペースを接続するために追加したコードを確認してください。私はそれをチェックし、それは常にキースペースに接続されていますが、依然として問題があります。しかし、いくつかの変更の後、私はテーブルを構成していません...エラー –

関連する問題