> show dbs;
local 0.203125GB
test 0.203125GB
use test;
db.testdb.find();
{ "_id" : ObjectId("5284e5cb1f4eb215b2ecc463"), "test1" : "testval1" }
查询后数据已经同步过来了.再看看日志,发现从主机确实从主机同步了数据.
查看服务状态
> db.printReplicationInfo();
this is a slave, printing slave replication info.
source: 43.241.222.110:27017
syncedTo: Sun Nov 17 2013 16:04:02 GMT+0800 (CST) = -54 secs ago (-0.01hrs)
CoamReSet:PRIMARY> use test
switched to db test
CoamReSet:PRIMARY> show collections
CoamReSet:PRIMARY> db.guids.insert({"name":"replica set","author":"webinglin"})
WriteResult({ "nInserted" : 1 })
CoamReSet:PRIMARY> exit
bye
在 45.63.50.67 Secondary 节点中查询数据,验证是否能够正常的同步机器.
root@ubuntu:~# mongo --host 45.63.50.67
MongoDB shell version: 3.0.3
connecting to: 45.63.50.67:27017/test
Server has startup warnings:
2015-06-09T17:03:27.744-0700 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not re commended.
2015-06-09T17:03:27.744-0700 I CONTROL [initandlisten]
2015-06-09T17:03:27.745-0700 I CONTROL [initandlisten]
2015-06-09T17:03:27.745-0700 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2015-06-09T17:03:27.745-0700 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2015-06-09T17:03:27.745-0700 I CONTROL [initandlisten]
CoamReSet:SECONDARY> show dbs
2015-06-09T17:13:49.138-0700 E QUERY Error: listDatabases failed:{ "note" : "from execCommand", "ok" : 0, "errmsg" : "not master" }
at Error (<anonymous>)
at Mongo.getDBs (src/mongo/shell/mongo.js:47:15)
at shellHelper.show (src/mongo/shell/utils.js:630:33)
at shellHelper (src/mongo/shell/utils.js:524:36)
at (shellhelp2):1:1 at src/mongo/shell/mongo.js:47
CoamReSet:SECONDARY> use test
switched to db test
CoamReSet:SECONDARY> db.guids.find()
Error: error: { "$err" : "not master and slaveOk=false", "code" : 13435 }
CoamReSet:SECONDARY> rs.slaveOk()
CoamReSet:SECONDARY> rs.slaveOk()
CoamReSet:SECONDARY> db.guids.find()
{ "_id" : ObjectId("557780ebd147e9391020860d"), "name" : "replica set", "author" : "webinglin" }
CoamReSet:SECONDARY> show collections()
2015-06-09T17:14:24.219-0700 E QUERY Error: don't know how to show [collections()]
at Error (<anonymous>)
at shellHelper.show (src/mongo/shell/utils.js:733:11)
at shellHelper (src/mongo/shell/utils.js:524:36)
at (shellhelp2):1:1 at src/mongo/shell/utils.js:733
CoamReSet:SECONDARY> show collections
guids
system.indexes
CoamReSet:SECONDARY> exit
bye
在 42.96.194.60 Secondary 节点中查询数据,验证是否能够正常的同步机器.
root@ubuntu:~# mongo --host 42.96.194.60
MongoDB shell version: 3.0.3
connecting to: 42.96.194.60:27017/test
Server has startup warnings:
2015-06-09T17:03:11.647-0700 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not re commended.
2015-06-09T17:03:11.647-0700 I CONTROL [initandlisten]
2015-06-09T17:03:11.647-0700 I CONTROL [initandlisten]
2015-06-09T17:03:11.648-0700 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2015-06-09T17:03:11.648-0700 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2015-06-09T17:03:11.648-0700 I CONTROL [initandlisten]
CoamReSet:SECONDARY> rs.slaveOk()
CoamReSet:SECONDARY> show dbs
local 1.078GB
test 0.078GB
CoamReSet:SECONDARY> use test
switched to db test
CoamReSet:SECONDARY> show collections
guids
system.indexes
CoamReSet:SECONDARY> db.guids.find()
{ "_id" : ObjectId("557780ebd147e9391020860d"), "name" : "replica set", "author" : "webinglin" }
CoamReSet:SECONDARY> exit
bye
CoamReSet:RECOVERING> config = rs.conf(); CoamReSet:RECOVERING> config.members[2].priority = 0; CoamReSet:RECOVERING> rs.reconfig(config); { "ok" : 0, "errmsg" : "replSetReconfig should only be run on PRIMARY, but my state is RECOVERING; use the \"force\" argument to override", "code" : 10107 } CoamReSet:RECOVERING> rs.reconfig(config,{force: true}); { "ok" : 1 }
[Composer\Downloader\TransportException] Your configuration does not allow connection to http://packagist.com. See https://getcomposer.org/doc/06-config.md#secure-http for details
IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at /etc/letsencrypt/live/coopens.com/fullchain.pem. Your cert will expire on 2016-03-22. To obtain a new version of the certificate in the future, simply run Let's Encrypt again. - If you like Let's Encrypt, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le
Execution failed for task ':assetManager:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'G:\Program Files\Android\sdk\build-tools\22.0.1\aapt.exe'' finished with non-zero exit value 1
Error:Execution failed for task ':assetManager:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'G:\Program Files\Java\jdk8\bin\java.exe'' finished with non-zero exit value 2
Error:Execution failed for task ':assetManager:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'G:\Program Files\Java\jdk8\bin\java.exe'' finished with non-zero exit value 1
:app:processDebugManifest
F:\BaiDuCloud\StudioProjects\ShangYun\app\src\debug\AndroidManifest.xml:68:9-38 Error:
Attribute application@icon value=(@drawable/logo) from AndroidManifest.xml:68:9-38
is also present at [com.daimajia.easing:library:1.0.0] AndroidManifest.xml:13:9-45 value=(@drawable/ic_launcher)
Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:65:5-580:19 to override
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@icon value=(@drawable/logo) from AndroidManifest.xml:68:9-38
is also present at [com.daimajia.easing:library:1.0.0] AndroidManifest.xml:13:9-45 value=(@drawable/ic_launcher)
Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:65:5-580:19 to override