2016-07-20 18 views
0

私はMongo java非同期ドライバv3.2を使用して、次のテストを行っています。コールバックが呼び出されたことがわかります(MongoコレクションのinsertOne呼び出しで登録されたもの)。テストクライアントがmongosプロセス(最後に添付されたログ)に接続できることがわかります。私はモンゴでは何の書類も見ない。シャーディング用のデータベースコレクションを有効にして、mongosプロセスからshard statusコマンドを実行することもできます。セットアップで誤って設定されている可能性のある考えはありますか?文書をmongoシャードに挿入する

 CountDownLatch latch = new CountDownLatch(1); 
     SingleResultCallback<Void> callbackWhenFinished = new SingleResultCallback<Void>() { 
      @Override 
      public void onResult(final Void result, final Throwable t) { 
       System.out.println("Operation Finished!"); 
       latch.countDown(); 
      } 
     }; 
final Document doc = new Document("name", "MongoDB") 
       .append("type", "database") 
       .append("count", 1) 
       .append("info", new Document("x", 203).append("y", 102)); 
     collection.insertOne(doc, callbackWhenFinished); 
     latch.await(); 

モンゴログ:

this host as shard shard0002, but shard name was previously initialized as shard0001" } } 
2016-07-20T12:02:52.682-0400 I NETWORK [mongosMain] connection accepted from 127.0.0.1:44633 #42 (1 connection now open) 
2016-07-20T12:02:52.715-0400 I NETWORK [mongosMain] connection accepted from 127.0.0.1:44635 #43 (2 connections now open) 
2016-07-20T12:02:52.750-0400 I NETWORK [conn42] end connection 127.0.0.1:44633 (1 connection now open) 
2016-07-20T12:02:52.750-0400 I NETWORK [conn43] end connection 127.0.0.1:44635 (0 connections now open) 
2016-07-20T12:02:57.279-0400 I SHARDING [Balancer] caught exception while doing balance: remote client 127.0.0.1:40696 tried to initialize this host as shard shard0002, but shard name was previously initialized as shard0001 
2016-07-20T12:02:57.279-0400 I SHARDING [Balancer] about to log metadata event into actionlog: { _id: "ali-HP-ENVY-m7-Notebook-2016-07-20T12:02:57.279-0400-578fa0b154165752fe990d83", server: "ali-HP-ENVY-m7-Notebook", clientAddr: "", time: new Date(1469030577279), what: "balancer.round", ns: "", details: { executionTimeMillis: 5, errorOccured: true, errmsg: "remote client 127.0.0.1:40696 tried to initialize this host as shard shard0002, but shard name was previously initialized as shard0001" } } 
2016-07-20T12:03:07.334-0400 I SHARDING [Balancer] caught exception while doing balance: remote client 127.0.0.1:40704 tried to initialize this host as shard shard0002, but shard name was previously initialized as shard0001 
2016-07-20T12:03:07.335-0400 I SHARDING [Balancer] about to log metadata event into actionlog: { _id: "ali-HP-ENVY-m7-Notebook-2016-07-20T12:03:07.335-0400-578fa0bb54165752fe990d84", server: "ali-HP-ENVY-m7-Notebook", clientAddr: "", time: new Date(1469030587335), what: "balancer.round", ns: "", details: { executionTimeMillis: 3, errorOccured: true, errmsg: "remote client 127.0.0.1:40704 tried to initialize this host as shard shard0002, but shard name was previously initialized as shard0001" } } 

答えて

0

問題が(レプリカセットを持つクエリルータ、cofigサーバとのmongo破片)Mongoのクラスタを確保することによって解決されましたが、正しく構成されていました。これが完了すると、挿入物がシャード(およびマイグレーションしきい値に達した後で複数のシャード)に追加されているのがわかりました。他の人に役立つことを願っています

関連する問題