# 取消大页缓存 iftest -f /sys/kernel/mm/transparent_hugepage/enabled; then echo never > /sys/kernel/mm/transparent_hugepage/enabled fi iftest -f /sys/kernel/mm/transparent_hugepage/defrag; then echo never > /sys/kernel/mm/transparent_hugepage/defrag fi
# 可直接命令行启动:mongod --dbpath=/mongodb/data --logpath=/mongodb/log/mongodb.log --port=27017 --logappend --fork # 建议使用配置文件方式启动,先切换用户 [root@db01 ~]# su - mongod Last login: Sat Mar 30 21:08:40 CST 2019 on pts/0 [mongod@db01 ~]$ cat > /mongodb/conf/mongodb.conf<<EOF logpath=/mongodb/log/mongodb.log dbpath=/mongodb/data port=27017 logappend=true fork=true EOF
# 启动 [mongod@db01 ~]$ mongod -f /mongodb/conf/mongodb.conf about to fork child process, waiting until server is ready for connections. forked process: 3754 child process started successfully, parent exiting
# 默认使用27017端口 [mongod@db01 ~]$ netstat -tunlp (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 3754/mongod tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN - tcp6 0 0 :::111 :::* LISTEN - tcp6 0 0 :::22 :::* LISTEN - udp 0 0 0.0.0.0:1019 0.0.0.0:* - udp 0 0 0.0.0.0:111 0.0.0.0:* - udp6 0 0 :::1019 :::* - udp6 0 0 :::111 :::* - # 登录 [mongod@db01 ~]$ mongo MongoDB shell version v3.6.11-23-g0522785 connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb Implicit session: session { "id" : UUID("3262d22d-84b0-4c6c-aa12-470633b2eabf") } MongoDB server version: 3.6.11-23-g0522785 Server has startup warnings: 2019-03-30T21:10:28.597+0800 I CONTROL [initandlisten] 2019-03-30T21:10:28.597+0800 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database. 2019-03-30T21:10:28.597+0800 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted. 2019-03-30T21:10:28.597+0800 I CONTROL [initandlisten] 2019-03-30T21:10:28.597+0800 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost. 2019-03-30T21:10:28.597+0800 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server. 2019-03-30T21:10:28.597+0800 I CONTROL [initandlisten] ** Start the server with --bind_ip <address> to specify which IP 2019-03-30T21:10:28.597+0800 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to 2019-03-30T21:10:28.597+0800 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the 2019-03-30T21:10:28.597+0800 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning. 2019-03-30T21:10:28.597+0800 I CONTROL [initandlisten] 2019-03-30T21:10:28.597+0800 I CONTROL [initandlisten] 2019-03-30T21:10:28.597+0800 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 4096 processes, 65536 files. Number of processes should be at least 32768 : 0.5 times number of files. >
# 关闭mongod [mongod@db01 ~]$ mongod -f /mongodb/conf/mongodb.conf --shutdown killing process with pid: 3754