Homebrew Unknown command services

macOS运行brew services报错 …

➜  ~ brew services start jenkins-lts
==> Tapping homebrew/services
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services'...
error: could not lock config file /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services/.git/config: No such file or directory
fatal: could not set 'core.repositoryformatversion' to '0'
Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-services /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services --origin=origin --template= --config core.fsmonitor=false` exited with 128.
Error: Failure while executing; `/usr/local/bin/brew tap homebrew/services` exited with 1.
阅读更多

Not authorized on admin to execute command

NextJS使用mongoose连接数据库的时候报错 …

MongoServerError: Authentication failed.
at Connection.onMessage (/Users/net.cctv3.i/chnqoo-recollections-service/node_modules/mongodb/lib/cmap/connection.js:205:26)
at MessageStream.<anonymous> (/Users/net.cctv3.i/chnqoo-recollections-service/node_modules/mongodb/lib/cmap/connection.js:64:60)
at MessageStream.emit (node:events:518:28)
at processIncomingData (/Users/net.cctv3.i/chnqoo-recollections-service/node_modules/mongodb/lib/cmap/message_stream.js:117:16)
at MessageStream._write (/Users/net.cctv3.i/chnqoo-recollections-service/node_modules/mongodb/lib/cmap/message_stream.js:33:9)
at writeOrBuffer (node:internal/streams/writable:564:12)
at _write (node:internal/streams/writable:493:10)
at Writable.write (node:internal/streams/writable:502:10)
at Socket.ondata (node:internal/streams/readable:1007:22)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
at TCP.callbackTrampoline (node:internal/async_hooks:130:17) {
ok: 0,
code: 18,
codeName: 'AuthenticationFailed',
connectionGeneration: 0,
[Symbol(errorLabels)]: Set(2) { 'HandshakeError', 'ResetPool' }
}
阅读更多

MongoDB 设置远程连接

修改配置文件mongod.conf

Linux配置文件路径,/etc/mongod.conf

net:
port: 27017
- bindIp: 127.0.0.1
+ bindIp: 0.0.0.0

# 密码登录
security:
authorization: enabled

创建用户

> use admin
switched to db admin
> db.createUser({
user: '??????',
pwd: '123456',
roles: [{role: 'userAdminAnyDatabase', db: 'admin'}],
});
阅读更多