egg-cnode
egg-cnode copied to clipboard
nodejs.MongoError: not authorized on egg_cnode to execute command { listIndexes: "topics", cursor: {} }
使用egg-cnode 在本地搭建 报错
kk@V1:~/src$ ls
app bin docker-compose.yml LICENSE package.json run
app.js config Dockerfile logs package-lock.json test
appveyor.yml docker-compose.dev.yml init.d node_modules README.md tutorials
npm i
kk@V1:~/src$ npm i
npm WARN [email protected] requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of mocha@>=1.18 <6 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
up to date in 16.837s
npm run dev
kk@V1:~/src$ npm run dev
> [email protected] dev /home/kk/src
> egg-bin dev
2018-06-29 16:22:02,725 INFO 3037 [master] node version v8.11.3
2018-06-29 16:22:02,727 INFO 3037 [master] egg version 2.9.1
2018-06-29 16:22:03,499 INFO 3037 [master] agent_worker#1:3043 started (768ms)
2018-06-29 16:22:05,189 INFO 3037 [master] egg started on http://127.0.0.1:7001 (2462ms)
2018-06-29 16:22:05,236 ERROR 3053 nodejs.MongoError: not authorized on egg_cnode to execute command { listIndexes: "topics", cursor: {} }
at Function.MongoError.create (/home/kk/src/node_modules/mongodb-core/lib/error.js:31:11)
at queryCallback (/home/kk/src/node_modules/mongodb-core/lib/cursor.js:212:36)
at /home/kk/src/node_modules/mongodb-core/lib/connection/pool.js:469:18
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
name: 'MongoError'
message: 'not authorized on egg_cnode to execute command { listIndexes: "topics", cursor: {} }'
ok: 0
errmsg: 'not authorized on egg_cnode to execute command { listIndexes: "topics", cursor: {} }'
code: 13
pid: 3053
hostname: V1
2018-06-29 16:22:05,241 ERROR 3053 nodejs.MongoError: not authorized on egg_cnode to execute command { listIndexes: "replies", cursor: {} }
at Function.MongoError.create (/home/kk/src/node_modules/mongodb-core/lib/error.js:31:11)
at queryCallback (/home/kk/src/node_modules/mongodb-core/lib/cursor.js:212:36)
at /home/kk/src/node_modules/mongodb-core/lib/connection/pool.js:469:18
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
name: 'MongoError'
message: 'not authorized on egg_cnode to execute command { listIndexes: "replies", cursor: {} }'
ok: 0
errmsg: 'not authorized on egg_cnode to execute command { listIndexes: "replies", cursor: {} }'
code: 13
pid: 3053
hostname: V1
2018-06-29 16:22:05,245 ERROR 3053 nodejs.MongoError: not authorized on egg_cnode to execute command { listIndexes: "topiccollects", cursor: {} }
at Function.MongoError.create (/home/kk/src/node_modules/mongodb-core/lib/error.js:31:11)
at queryCallback (/home/kk/src/node_modules/mongodb-core/lib/cursor.js:212:36)
at /home/kk/src/node_modules/mongodb-core/lib/connection/pool.js:469:18
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
name: 'MongoError'
message: 'not authorized on egg_cnode to execute command { listIndexes: "topiccollects", cursor: {} }'
ok: 0
errmsg: 'not authorized on egg_cnode to execute command { listIndexes: "topiccollects", cursor: {} }'
code: 13
pid: 3053
hostname: V1
2018-06-29 16:22:05,248 ERROR 3053 nodejs.MongoError: not authorized on egg_cnode to execute command { listIndexes: "messages", cursor: {} }
at Function.MongoError.create (/home/kk/src/node_modules/mongodb-core/lib/error.js:31:11)
at queryCallback (/home/kk/src/node_modules/mongodb-core/lib/cursor.js:212:36)
at /home/kk/src/node_modules/mongodb-core/lib/connection/pool.js:469:18
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
name: 'MongoError'
message: 'not authorized on egg_cnode to execute command { listIndexes: "messages", cursor: {} }'
ok: 0
errmsg: 'not authorized on egg_cnode to execute command { listIndexes: "messages", cursor: {} }'
code: 13
pid: 3053
hostname: V1
2018-06-29 16:22:05,249 ERROR 3053 nodejs.MongoError: not authorized on egg_cnode to execute command { listIndexes: "users", cursor: {} }
at Function.MongoError.create (/home/kk/src/node_modules/mongodb-core/lib/error.js:31:11)
at queryCallback (/home/kk/src/node_modules/mongodb-core/lib/cursor.js:212:36)
at /home/kk/src/node_modules/mongodb-core/lib/connection/pool.js:469:18
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
name: 'MongoError'
message: 'not authorized on egg_cnode to execute command { listIndexes: "users", cursor: {} }'
ok: 0
errmsg: 'not authorized on egg_cnode to execute command { listIndexes: "users", cursor: {} }'
code: 13
pid: 3053
hostname: V1
出现这个问题,是因为mongodb版本升级到了4.0.0? cnode,org上面跑得是3.2版本的mongodb
应该怎么修改呢?
kk@V1:~/src$ sudo service mongod start
kk@V1:~/src$ cat /var/log/mongodb/mongod.log
2018-06-29T18:22:10.401+0800 I CONTROL [initandlisten] MongoDB starting : pid=5158 port=27017 dbpath=/var/lib/mongodb 64-bit host=V1
2018-06-29T18:22:10.401+0800 I CONTROL [initandlisten] db version v4.0.0
2018-06-29T18:22:10.401+0800 I CONTROL [initandlisten] git version: 3b07af3d4f471ae89e8186d33bbb1d5259597d51
2018-06-29T18:22:10.401+0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.0f 25 May 2017
2018-06-29T18:22:10.401+0800 I CONTROL [initandlisten] allocator: tcmalloc
2018-06-29T18:22:10.401+0800 I CONTROL [initandlisten] modules: none
2018-06-29T18:22:10.401+0800 I CONTROL [initandlisten] build environment:
2018-06-29T18:22:10.401+0800 I CONTROL [initandlisten] distmod: debian92
2018-06-29T18:22:10.401+0800 I CONTROL [initandlisten] distarch: x86_64
2018-06-29T18:22:10.401+0800 I CONTROL [initandlisten] target_arch: x86_64
2018-06-29T18:22:10.401+0800 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, processManagement: { timeZoneInfo: "/usr/share/zoneinfo" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2018-06-29T18:22:10.413+0800 E STORAGE [initandlisten] Failed to set up listener: SocketException: Address already in use
2018-06-29T18:22:10.413+0800 I CONTROL [initandlisten] now exiting
2018-06-29T18:22:10.413+0800 I CONTROL [initandlisten] shutting down with code:48
2018-06-29T19:09:29.897+0800 I CONTROL [main] ***** SERVER RESTARTED *****
2018-06-29T19:09:30.169+0800 I CONTROL [initandlisten] MongoDB starting : pid=2320 port=27017 dbpath=/var/lib/mongodb 64-bit host=V1
2018-06-29T19:09:30.169+0800 I CONTROL [initandlisten] db version v4.0.0
2018-06-29T19:09:30.169+0800 I CONTROL [initandlisten] git version: 3b07af3d4f471ae89e8186d33bbb1d5259597d51
2018-06-29T19:09:30.169+0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.0f 25 May 2017
2018-06-29T19:09:30.169+0800 I CONTROL [initandlisten] allocator: tcmalloc
2018-06-29T19:09:30.169+0800 I CONTROL [initandlisten] modules: none
2018-06-29T19:09:30.169+0800 I CONTROL [initandlisten] build environment:
2018-06-29T19:09:30.169+0800 I CONTROL [initandlisten] distmod: debian92
2018-06-29T19:09:30.169+0800 I CONTROL [initandlisten] distarch: x86_64
2018-06-29T19:09:30.169+0800 I CONTROL [initandlisten] target_arch: x86_64
2018-06-29T19:09:30.169+0800 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, processManagement: { timeZoneInfo: "/usr/share/zoneinfo" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2018-06-29T19:09:30.199+0800 E STORAGE [initandlisten] Failed to set up listener: SocketException: Address already in use
2018-06-29T19:09:30.200+0800 I CONTROL [initandlisten] now exiting
2018-06-29T19:09:30.200+0800 I CONTROL [initandlisten] shutting down with code:48
2018-06-29T19:11:01.663+0800 I CONTROL [main] ***** SERVER RESTARTED *****
2018-06-29T19:11:01.679+0800 I CONTROL [initandlisten] MongoDB starting : pid=2348 port=27017 dbpath=/var/lib/mongodb 64-bit host=V1
2018-06-29T19:11:01.679+0800 I CONTROL [initandlisten] db version v4.0.0
2018-06-29T19:11:01.679+0800 I CONTROL [initandlisten] git version: 3b07af3d4f471ae89e8186d33bbb1d5259597d51
2018-06-29T19:11:01.679+0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.0f 25 May 2017
2018-06-29T19:11:01.679+0800 I CONTROL [initandlisten] allocator: tcmalloc
2018-06-29T19:11:01.679+0800 I CONTROL [initandlisten] modules: none
2018-06-29T19:11:01.679+0800 I CONTROL [initandlisten] build environment:
2018-06-29T19:11:01.679+0800 I CONTROL [initandlisten] distmod: debian92
2018-06-29T19:11:01.679+0800 I CONTROL [initandlisten] distarch: x86_64
2018-06-29T19:11:01.679+0800 I CONTROL [initandlisten] target_arch: x86_64
2018-06-29T19:11:01.679+0800 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, processManagement: { timeZoneInfo: "/usr/share/zoneinfo" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2018-06-29T19:11:01.680+0800 E STORAGE [initandlisten] Failed to set up listener: SocketException: Address already in use
2018-06-29T19:11:01.680+0800 I CONTROL [initandlisten] now exiting
2018-06-29T19:11:01.680+0800 I CONTROL [initandlisten] shutting down with code:48
连接字符串配置不对吧