This is my configuration file
port=27017 #端口號
fork=true #以守護(hù)進(jìn)程的方式運(yùn)行,創(chuàng)建服務(wù)器進(jìn)程
# master=true #單主從配置時設(shè)為主服務(wù)器
#salve=true ##單主從配置時設(shè)為從服務(wù)器
logpath=~/database/data/log.log #日志輸出文件路徑
logappend=true #日志輸出方式
dbpath=~/database/data/db/ #數(shù)據(jù)庫路徑
# replSet=testrs #設(shè)置富本集的名字
# shardsvr=true #設(shè)置是否分片
# auth=true#是否開啟授權(quán)
mongod -f ~/database/data/mongodb.conf
Tried to start, and then reported an error:
about to fork child process, waiting until server is ready for connections.
forked process: 27916
ERROR: child process failed, exited with error number 1
This situation is probably because there is a problem with the path and permissions of the log file
There has been a similar discussion on stackoverflow: http://stackoverflow.com/ques...
The poster himself found a solution by changing the path of the log file to /home/<user>
an absolute path.
Use ~
to represent home. It is an alias provided by the shell and can only be used in the shell.