您好,登錄后才能下訂單哦!
一、使用yum安裝mongodb 3.2
[root@node2 ~]# cat /etc/yum.repos.d/mongodb.repo [mongodb-org-3.2] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/ gpgcheck=0 enabled=1 [root@node2 ~]# yum install mongodb-org* [root@node2 ~]# egrep -v "^(#|$)" /etc/mongod.conf systemLog: destination: file logAppend: true path: /data/mongodb/log/mongod.log storage: dbPath: /data/mongodb/data directoryPerDB: true journal: enabled: true processManagement: fork: true # fork and run in background pidFilePath: /data/mongodb/conf/mongod.pid # location of pidfile net: port: 27027 #bindIp: 127.0.0.1 # Listen to local interface only, comment to listen on all interfaces. [root@node2 ~]# mkdir -p /data/mongodb/{conf,data,log} [root@node2 ~]# chown -R mongod. /data/mongodb [root@node2 ~]# tail /etc/security/limits.conf # End of file mongod soft nproc 40000 * hard nofile 1000000 * soft nofile 1000000 * soft core unlimited * soft stack 10240 * - nofile 65535 push - nproc 65535 push - nofile 320000 work - nproc 10000 [root@node2 ~]# cat /etc/security/limits.d/90-nproc.conf # Default limit for number of user's processes to prevent # accidental fork bombs. # See rhbz #432903 for reasoning. * soft nproc 1024 root soft nproc unlimited [root@node2 ~]# [root@node2 ~]# sed -n '62,64p' /etc/init.d/mongod if [ -f /sys/kernel/mm/transparent_hugepage/defrag ] ; then echo never > /sys/kernel/mm/transparent_hugepage/defrag fi [root@node2 ~]# service mongod start
二、macbook pro 上安裝mongodb
參考: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
安裝brew: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
brew install mongodb
mongod - -config /usr/local/etc/mongod.conf
三、mongo 客戶端工具有: http://docs.mongodb.org/ecosystem/tools/administration-interfaces/
四、Cent0S7 上部署mongo3.6(補)
[root@meteor ~]# echo "never" > /sys/kernel/mm/transparent_hugepage/defrag [root@meteor ~]# cat /etc/yum.repos.d/mongo.repo [mongodb-org-3.6] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.6/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc [root@meteor ~]# yum install mongodb-org [root@meteor ~]# mkdir -p /data/mongodb/{conf,data,logs,run} [root@meteor ~]# chown -R mongod.mongod /data/mongodb [root@meteor ~]# vim /usr/lib/systemd/system/mongod.service [root@meteor ~]# cat /usr/lib/systemd/system/mongod.service [Unit] Description=High-performance, schema-free document-oriented database After=network.target Documentation=https://docs.mongodb.org/manual [Service] User=mongod Group=mongod Environment="OPTIONS=-f /etc/mongod.conf" ExecStart=/usr/bin/mongod $OPTIONS ExecStartPre=/usr/bin/mkdir -p /data/mongodb/run ExecStartPre=/usr/bin/chown mongod:mongod /data/mongodb/run ExecStartPre=/usr/bin/chmod 0755 /data/mongodb/run PermissionsStartOnly=true PIDFile=/data/mongodb/run/mongod.pid Type=forking # file size LimitFSIZE=infinity # cpu time LimitCPU=infinity # virtual memory size LimitAS=infinity # open files LimitNOFILE=64000 # processes/threads LimitNPROC=64000 # locked memory LimitMEMLOCK=infinity # total threads (user+kernel) TasksMax=infinity TasksAccounting=false # Recommended limits for for mongod as specified in # http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings [Install] WantedBy=multi-user.target [root@meteor ~]# [root@meteor ~]# systemctl daemon-reload [root@meteor ~]# vim /etc/mongod.conf [root@meteor ~]# grep -Pv "^( *#|$)" /etc/mongod.conf systemLog: destination: file logAppend: true path: /data/mongodb/logs/mongod.log storage: dbPath: /data/mongodb/data/ directoryPerDB: true journal: enabled: true processManagement: fork: true # fork and run in background pidFilePath: /data/mongodb/run/mongod.pid # location of pidfile timeZoneInfo: /usr/share/zoneinfo net: port: 27027 security: authorization: enabled keyFile: /data/mongodb/conf/keyFile [root@meteor ~]# 注:mongodb配置文件中的各路徑一定要與systemd下mongod.service文件中的各路徑設置一致,否則會導致無法啟動或啟動錯誤(返回值100)。 [root@meteor ~]# openssl rand -base64 755 > /data/mongodb/conf/keyFile [root@meteor ~]# cat /data/mongodb/conf/keyFile wdanB7wdkV58W7DLP0UcoAOEGyiDDW1Z1QWy0LW836xqgDtZZ99iMQS9kgBc9pe3 ejt+KojFJS3R/YlV6cW+NC7xIBL1GEn48zwbrKnGUlQHRFOrAPqpf2btVZyYXbkD MRxfTU/Z2NN0ui3S0o7d1OyL3XQGS8Rv1Tk7bj/6VgLfGW8+/fLJ27T9Nj3eNr4H zt/8fgf4C4x0cBtfpQ13GQJV2hWsC9deUXdRrPfrn7Tn3ChnLr10NpCVRwvoik+a wfvx6vQpW9UtHxL/4XaRrVPWFDBqZMaDoHlcxEnq4d2mKTxJKStdpB+MmOT76ac6 lbTUrbFbmMnC4roRAAteCX4NsALMCnAFxxBryZAb9rEQvWwcX0IF0n+GKVIXShHw L6FHRRagi64bxFYIaLKrI05dZ2HRwLXKJUyM9xgy5ER9dyyDx0M1GRrGNVhse9rk g/Jts8eoqZoV/P6RaO6etOEs3ePhs/upeROaHrNSzi2L0CwbuIICkRCIHXeO1zqA XN0neGgA5wPCXQe3awwZym2N0EKy2SEvb+gep6etlfz2XMzMt0LK48SV978A4HrM Iw9wyWnlMEoUoYhUN3YgQvwscBQbYpB83X2QWOBuHyNMwe1zYUnA+3p1HMuzj749 1pqkPJHofR8eYu9BgqwufZASOg6PwO2jUBKwYt76yve/Yig3rBiDjvSDbFSmGd4M sf+0vqZB6kpnINgmEG09UjXZLIDQpbasz80cI+kJ4m2rKSS+GLZMVdSlNPOjW6UX djnj/PzbbWv9gVjrBWVCqsGk9mDkLSWw3xAhlJW8zsICskD437XXE/srwffBix0O 7ubng/7Fc018f7D/NRb2nYFxxA0h5Y0ek7pTEovuciQ0OY4qW+BDnsneZxWUx07R wJMzICcSb7SGWwtwmHb34KPIIIsrmmKQjNMux09HrvUXG7GpVJzPxlGkXjuiqlHB duvy5SYx425aygrg5hf40qbbwnkzTAi8v9Njj9oqEI9FQ/k= [root@meteor ~]# chown mongod.mongod /data/mongodb/conf/keyFile [root@meteor ~]# chmod 400 /data/mongodb/conf/keyFile #該文件權限一定要是400或600 [root@meteor ~]# vim /etc/mongod.conf [root@meteor ~]# grep keyFile /etc/mongod.conf keyFile: /data/mongodb/conf/keyFile [root@meteor ~]# systemctl restart mongod [root@meteor ~]#
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。