国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

CentOS7安裝使用MongoDB 3.4 單節(jié)點(for Hygieia)

liujs / 507人閱讀

摘要:安裝準(zhǔn)備安裝設(shè)置安裝源國內(nèi)使用阿里云鏡像源安裝修改默認(rèn)配置可選同時注釋掉只監(jiān)聽的設(shè)置修改為數(shù)據(jù)存儲目錄,并確保用戶可讀寫默認(rèn)監(jiān)聽本地,注釋掉創(chuàng)建數(shù)據(jù)庫登錄數(shù)據(jù)庫創(chuàng)建數(shù)據(jù)庫安裝請參考

安裝準(zhǔn)備

NUMA Settings

Running MongoDB on a system with Non-Uniform Access Memory (NUMA) can cause a number of operational problems, including slow performance for periods of time and high system process usage.

sysctl -w vm.zone_reclaim_mode=0

Kernel and File Systems

When running MongoDB in production on Linux, you should use Linux kernel version 2.6.36 or later,
with either the XFS or EXT4 filesystem. If possible, use XFS as it generally performs better with MongoDB.

XFS is the default file system for CentOS7.

DNS settings

cat > /etc/resolv.conf << EOF
nameserver 172.20.224.134
EOF

NTP Settings

Use the Network Time Protocol (NTP) to synchronize time among your hosts. This is especially important in sharded clusters.

yum -y install chrony
#sync time from local time server
sed -i "/^server*/d" /etc/chrony.conf
sed -i -e "/^# Please consider*/aserver ntp01" /etc/chrony.conf
systemctl enable chronyd && systemctl restart chronyd

Turn off Atime

Turn off atime for the storage volume containing the database files.
add mount option "noatime,nodiratime" in /etc/fstab

vim /etc/fstab
/dev/mapper/VolGroup-lv_data /data     xfs    defaults,noatime,nodiratime     1 1

ulimt settings

Set the file descriptor limit, -n, and the user process limit (ulimit), -u, above 20,000, according to the suggestions in the ulimit reference.

#check ulimit
ulimit -a

#set ulimit for mongod
cat >> /etc/security/limits.conf << EOF
 mongod soft nproc 65535
 mongod hard nproc 65535
EOF

Disable Transparent Huge Pages

MongoDB performs better with normal (4096 bytes) virtual memory pages.

echo never > /sys/kernel/mm/transparent_hugepage/enabled;
echo never > /sys/kernel/mm/transparent_hugepage/defrag;
chmod +x /etc/rc.d/rc.local

For CentOS 6 , refer to Disable Transparent Huge Pages

Disable selinux

It"s better to set selinux permissive ranther than disabled

sed -i s/^SELINUX=.*/SELINUX=permissive/g /etc/selinux/config

Disable iptables

service iptables stop && chkconfig iptables off
service ip6tables stop && chkconfig ip6tables off

sshd tunning

disable dns search when connecting to this server;
disable PasswordAuthentication confirm when ssh to other servers.

sed -i "s/^#UseDNS yes/UseDNS no/" /etc/ssh/sshd_config
sed -i "s/^#PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config

Set the readahead setting

Setting a higher readahead benefits sequential I/O operations. However, since MongoDB disk access patterns are generally random, setting a higher readahead provides limited benefit or performance degradation.

For the WiredTiger storage engine, a readahead of 0 or 16 provides optimal MongoDB performance.

For the MMAPv1 storage enginem, A readahead of 32 (16 kB) often works well.

#get the readahead settings of block device
blockdev --report
#change the readahead settings
blockdev --setra  
blockdev --setra  256 /dev/xvda

安裝mongodb

設(shè)置安裝yum源

國內(nèi)使用阿里云鏡像源

cat > /etc/yum.repos.d/mongodb-org-3.4.repo << EOF
[mongodb-org-3.4]
name=MongoDB Repository
#baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
baseurl=https://mirrors.aliyun.com/mongodb/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=0
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
EOF

安裝mongodb

yum -y install mongodb-org
systemctl enable mongod
systemctl start mongod

修改默認(rèn)配置(可選)

同時注釋掉只監(jiān)聽localhost的設(shè)置:

mkdir -pv /data/mongodb/storage
chown -R mongod /data/mongodb/storage

vim /etc/mongod.conf

# Where and how to store data.
storage:
  dbPath: /data/mongodb/storage  #修改為數(shù)據(jù)存儲目錄,并確保mongod用戶可讀寫
  journal:
    enabled: true
 

# network interfaces
net:
  port: 27017
#  bindIp: 127.0.0.1  #默認(rèn)監(jiān)聽本地lo,注釋掉interfaces.
systemctl restart mongod

創(chuàng)建數(shù)據(jù)庫

#登錄數(shù)據(jù)庫
mongo

#創(chuàng)建數(shù)據(jù)庫dashboarddb
use dashboarddb

#Create db user
db.createUser(
  {
    user: "dashboarduser",
    pwd: "dbpassword",
    roles: [
    {role: "readWrite", db: "dashboarddb"}
    ]
  })

centos6 安裝mongodb請參考

http://wiki.timanetwork.com/p...

文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請注明本文地址:http://specialneedsforspecialkids.com/yun/19266.html

相關(guān)文章

  • CentOS7安裝mongoDB3

    摘要:安裝創(chuàng)建,然后直接有安裝創(chuàng)建文件并編輯文件文件內(nèi)容為保存文件,然后運行一下命令安裝完成后,啟動這個方法參考官網(wǎng)的教程系統(tǒng)的方法應(yīng)該基本類似安裝圖形化管理界面都說不錯,但是我發(fā)現(xiàn)我這邊網(wǎng)絡(luò)根本登不了官網(wǎng),而且和的鏈接似乎還 安裝mongoDB 創(chuàng)建/etc/yum.repos.d/mongodb-org-3.4.repo,然后直接有yum安裝 #創(chuàng)建文件并編輯文件 vi /etc/yum...

    iKcamp 評論0 收藏0
  • CentOS7安裝mongoDB3

    摘要:安裝創(chuàng)建,然后直接有安裝創(chuàng)建文件并編輯文件文件內(nèi)容為保存文件,然后運行一下命令安裝完成后,啟動這個方法參考官網(wǎng)的教程系統(tǒng)的方法應(yīng)該基本類似安裝圖形化管理界面都說不錯,但是我發(fā)現(xiàn)我這邊網(wǎng)絡(luò)根本登不了官網(wǎng),而且和的鏈接似乎還 安裝mongoDB 創(chuàng)建/etc/yum.repos.d/mongodb-org-3.4.repo,然后直接有yum安裝 #創(chuàng)建文件并編輯文件 vi /etc/yum...

    zoomdong 評論0 收藏0

發(fā)表評論

0條評論

最新活動
閱讀需要支付1元查看
<