2017-03-07 21 views
0

私はLagomセットアップ用に外部カサンドラを設定しようとしています。私は私の独自の実装でLagom外部カサンドラ認証

    <configuration> 
         <unmanagedServices> 
          <cas_native>http://ip:9042</cas_native> 
         </unmanagedServices> 
         <cassandraEnabled>false</cassandraEnabled> 
        </configuration> 

を書かれているルートポンポンで

akka { 
persistent { 
    journal { 
    akka.persistence.journal.plugin = "this-cassandra-journal" 

     this-cassandra-journal { 
     contact-points = ["10.15.2.179"] 
     port = 9042 
     cluster-id = "cas_native" 

     keyspace = "hello" 

     authentication.username = "cassandra" 
     authentication.password = "rodney" 
     # Parameter indicating whether the journal keyspace should be auto created 
     keyspace-autocreate = true 

     # Parameter indicating whether the journal tables should be auto created 
     tables-autocreate = true 
     } 
    } 

    snapshot-store { 
    akka.persistence.snapshot-store.plugin = "this-cassandra-snapshot-store" 

     this-cassandra-snapshot-store { 
     contact-points = ["10.15.2.179"] 
     port = 9042 
     cluster-id = "cas_native" 

     keyspace = "hello_snap" 
     authentication.username = "cassandra" 
     authentication.password = "rodney" 
     # Parameter indicating whether the journal keyspace should be auto created 
     keyspace-autocreate = true 

     # Parameter indicating whether the journal tables should be auto created 
     tables-autocreate = true 
     } 
    } 

} 

をapplication.confしかし、私はまた、この設定

を提供しようとしたエラーに

[warn] a.p.c.j.CassandraJournal - Failed to connect to Cassandra and initialize. 
It will be retried on demand. Caused by: Authentication error on host /10.15.2. 
179:9042: Host /10.15.2.179:9042 requires authentication, but no authenticator f 
ound in Cluster configuration 
[warn] a.p.c.s.CassandraSnapshotStore - Failed to connect to Cassandra and initi 
alize. It will be retried on demand. Caused by: Authentication error on host /10 
.15.2.179:9042: Host /10.15.2.179:9042 requires authentication, but no authentic 
ator found in Cluster configuration 
[warn] a.p.c.j.CassandraJournal - Failed to connect to Cassandra and initialize. 
It will be retried on demand. Caused by: Authentication error on host /10.15.2. 
179:9042: Host /10.15.2.179:9042 requires authentication, but no authenticator f 
ound in Cluster configuration 
[error] a.c.s.PersistentShardCoordinator - Persistence failure when replaying ev 
ents for persistenceId [/sharding/ProductCoordinator]. Last known sequence numbe 
r [0] 
com.datastax.driver.core.exceptions.AuthenticationException: Authentication erro 
r on host /10.15.2.179:9042: Host /10.15.2.179:9042 requires authentication, but 
no authenticator found in Cluster configuration 
     at com.datastax.driver.core.AuthProvider$1.newAuthenticator(AuthProvider 
.java:40) 
     at com.datastax.driver.core.Connection$5.apply(Connection.java:250) 
     at com.datastax.driver.core.Connection$5.apply(Connection.java:234) 
     at com.google.common.util.concurrent.Futures$AsyncChainingFuture.doTrans 
form(Futures.java:1442) 
     at com.google.common.util.concurrent.Futures$AsyncChainingFuture.doTrans 
form(Futures.java:1433) 
     at com.google.common.util.concurrent.Futures$AbstractChainingFuture.run(
Futures.java:1408) 
     at com.google.common.util.concurrent.Futures$2$1.run(Futures.java:1177) 
     at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService 
.execute(MoreExecutors.java:310) 
     at com.google.common.util.concurrent.Futures$2.execute(Futures.java:1174 
) 

を取得します

lagom.persistence.read-side { 
    cassandra { 
    } 
} 

カッサンドラの資格情報を提供することでそれを動作させるにはどうすればいいですか?

答えて

4

はLagomでは、あなたはすでにあなたのjournalsnapshot-storeためakka-persistence-cassandra設定を使用することができます(source codeで参照reference.conf、およびcassandra-snapshot-store.authentication.*のために、下にスクロール)。

akka.persistence.journal.plugin = cassandra-journal akka.persistence.snapshot-store.plugin = cassandra-snapshot-store

がカサンドラにLagomを接続するときhttps://github.com/lagom/lagom/blob/c63383c343b02bd0c267ff176bfb4e48c7202d7d/persistence-cassandra/core/src/main/resources/play/reference-overrides.conf#L5-L6

第三最後のビットが設定するにはを参照してくださいLagomのリードさ:カサンドラの永続化のためのLagomのサポートはすでにアッカ永続実装としてakka-persistence-cassandraを宣言しているため、それを設定する必要はありません-側。これはthe defaultsを上書きするとapplication.confで実行することもできます。

それぞれのストレージで異なるCassandra Ring/Keyspace/credentials/...を使用する可能性があるので、個別に調整することができます。

Lagom docsの追加情報をご覧ください。

+0

ご返信ありがとうございます。私は3.0に私のcassandraバージョンを変更し、それは働き始めた。しかし、私はいくつかのクエリを持っています、まず私のプロジェクトは、mavenです。実際にカッサンドラに接続しているかどうかは、デバッグログから知ることはできません。また私のキースペースは、私が走っているCassandraサーバーには存在しません。 sbtプロジェクトを実行すると、キースペースが作成され、いくつかのデバッグログも見えました。次に、cluster-idは常に "cas_native"でなければなりませんか? –

関連する問題