Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MongoDB 3.2.4 configuration referenc

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

[mongo@vq12stmsg01 / app/mongo]

$top

Top-13:00:41 up 2 days, 21:35, 3 users, load average: 0.31,0.23,0.23

Tasks: 250 total, 1 running, 249 sleeping, 0 stopped, 0 zombie

% Cpu0: 0.7 us, 1.7 sy, 0.0 ni, 97.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st

% Cpu1: 5.0 us, 7.3 sy, 0.0 ni, 87.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st

% Cpu2: 1.0 us, 1.7 sy, 0.0 ni, 97.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st

% Cpu3: 0.7 us, 1.0 sy, 0.0 ni, 98.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st

% Cpu4: 5.6 us, 7.3 sy, 0.0 ni, 87.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st

% Cpu5: 0.0 us, 0.7 sy, 0.0 ni, 99.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st

% Cpu6: 0.3 us, 1.0 sy, 0.0 ni, 98.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st

% Cpu7: 5.3 us, 7.9 sy, 0.0 ni, 86.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st

% Cpu8: 0.3 us, 1.0 sy, 0.0 ni, 98.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st

% Cpu9: 1.0 us, 2.0 sy, 0.0 ni, 97.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st

% Cpu10: 5.3 us, 7.0 sy, 0.0 ni, 87.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st

% Cpu11: 1.3 us, 2.0 sy, 0.0 ni, 96.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st

KiB Mem: 41038580 total, 1805648 used, 39232932 free, 319880 buffers

KiB Swap: 0 total, 0 used, 0 free. 469688 cached Mem

[mongo@vq12stmsg01 / app/mongo]

$free-m

Total used free shared buffers cached

Mem: 40076 1762 38314 8 312 458

-/ + buffers/cache: 99139085

Swap: 0 0 0

[mongo@vq12stmsg01 / app/mongo]

$df-h

Filesystem Size Used Avail Use% Mounted on

/ dev/mapper/vg00-lv_root 19G 3.5G 14G 21% /

Devtmpfs 20G 0 20g 0% / dev

Tmpfs 20g 80K 20G 1% / dev/shm

Tmpfs 20G 8.9m 20G 1% / run

Tmpfs 20G 0 20g 0% / sys/fs/cgroup

/ dev/sda1 969M 95M 809M 11% / boot

/ dev/mapper/vg00-lv_data 40G 1.3G 80G 4% / data

/ dev/mapper/vg00-lv_app 21G 328M 19G 2% / app

Echo-ne "

10.78.200.105 vq12stmsg01

10.78.200.106 vq12stmsg02

10.78.200.107 vq12stmsg03

"> > / etc/hosts

Mkdir-p / app/logs/

105:

Mkdir-p / data/mdb/ {mdb1_1,mdb1_1/repair,mdb2_2,mdb2_2/repair,mdb3_3,mdb3_3/repair}

Mkdir-p / data/configdb/configdb1_1/repair

106:

Mkdir-p / data/mdb/ {mdb1_3,mdb1_3/repair,mdb2_1,mdb2_1/repair,mdb3_2,mdb3_2/repair}

Mkdir-p / data/configdb/configdb2_1/repair

107:

Mkdir-p / data/mdb/ {mdb1_2,mdb1_2/repair,mdb2_3,mdb2_3/repair,mdb3_1,mdb3_1/repair}

Mkdir-p / data/configdb/configdb3_1/repair

Systemctl stop firewalld.service

Systemctl disable firewalld.service

Openssl rand-base64 741 > / app/conf/keyfile

Chmod 600 / app/mongodb/conf/keyfile

Copy keyfile file to each node

Host environment variables and parameters, refer to

$cat / etc/rc.local

.

# MongoDB#

Sleep 2

Blockdev-setra 32 / dev/mapper/vg00-lv_data

Sleep 2

Echo '512' > / sys/block/sdb/queue/nr_requests

Sleep 2

Echo 0 > / proc/sys/vm/zone_reclaim_mode

# blockdev-- report / dev/mapper/vg00-lv_data

# chown mongo:dba-R / app/

# chown mongo:dba-R / data/

# MongoDB#

$cat / etc/fstab

#

# / etc/fstab

# Created by anaconda on Wed Mar 16 06:50:02 2016

#

# Accessible filesystems, by reference, are maintained under'/ dev/disk'

# See man pages fstab (5), findfs (8), mount (8) and/or blkid (8) for more info

#

/ dev/mapper/vg00-lv_root / ext3 defaults 1 1

/ dev/mapper/vg00-lv_app / app ext3 defaults 1 2

UUID=4f86d0d2-a559-4f07-8a91-a605e0005f5c / boot ext3 defaults 1 2

/ dev/mapper/vg00-lv_data / data ext4 noatime 00

$cat / etc/security/limits.conf

Mongo soft nofile 65535

Mongo hard nofile 65535

Mongo soft nproc 65535

Mongo hard nproc 65535

Close transparent pages

Https://docs.mongodb.org/manual/tutorial/transparent-huge-pages/

Https://docs.mongodb.org/manual/administration/production-checklist/

[mongo@vq12stmsg01 / app/mongo]

$cat .bash _ profile

...

# add by mongoDB#

Export LANG=en_US

Export PATH=$PATH:/app/mongodb_3_2_4/bin

Set-o vi

Stty erase ^ H

Umask 022

Export HISTTIMEFORMAT= `whoami` ":% hash% d -% H:%M:%S"

Export PS1='\ n\ e [1trans37m [\ e32m\ u\ e [1trans33m @\ e [m\ e] [1trans36m\ h\ e [m\ e [4m`pwd`\ e]\ e [m\ e [1ex36m\ e [m\ n\ $'

Alias' l=ls-altr'

Alias' cdm=cd / app/mongodb_3_2_4'

Alias' cdl=cd / app/logs'

Alias' cdc=cd / app/conf'

Alias' cddb=cd / data/'

Alias' mongosstart=numactl-- interleave=all mongos-- config=/app/conf/mongos1.conf'

Alias' configstart=numactl-- interleave=all mongod-- config=/app/conf/configsvr1_1.conf'

Alias' mongodstart1=numactl-- interleave=all mongod-- config=/app/conf/shardsvr1_1.conf'

Alias' mongodstart2=numactl-- interleave=all mongod-- config=/app/conf/shardsvr2_2.conf'

Alias' mongodstart3=numactl-- interleave=all mongod-- config=/app/conf/shardsvr3_3.conf'

Alias "mongosstop=ps-ef | grep-v grep | grep mongos | cut-c 9-15 | xargs kill-2"

Alias "mongodstop=ps-ef | grep-v grep | grep shardsvr | grep mongod | cut-c 9-15 | xargs kill-2"

Alias "mongocfgstop=ps-ef | grep-v grep | grep configsvr | cut-c 9-15 | xargs kill-2"

# add by mongoDB#

[mongo@vq12stmsg01 / app/conf]

$cat configsvr1_1.conf

SystemLog:

Destination: file

Path: "/ app/logs/configsvr1_1.log"

LogAppend: true

Storage:

DbPath: "/ data/configdb/configdb1_1"

RepairPath: "/ data/configdb/configdb1_1/repair"

Journal:

Enabled: true

CommitIntervalMs: 100

DirectoryPerDB: true

SyncPeriodSecs: 60

Engine: wiredTiger

WiredTiger:

EngineConfig:

CacheSizeGB: 1

JournalCompressor: snappy

DirectoryForIndexes: true

CollectionConfig:

BlockCompressor: snappy

IndexConfig:

PrefixCompression: true

ProcessManagement:

Fork: true

Net:

BindIp: 127.0.0.1,10.78.200.105

Port: 20000

Sharding:

ClusterRole: configsvr

Security:

Authorization: disabled

ClusterAuthMode: keyFile

KeyFile: / app/conf/keyfile

SetParameter:

EnableLocalhostAuthBypass: true

AuthenticationMechanisms: SCRAM-SHA-1

ConnPoolMaxShardedConnsPerHost: 200

ConnPoolMaxConnsPerHost: 5000

$cat mongos1.conf

SystemLog:

Destination: file

Path: / app/logs/mongos1.log

LogAppend: true

Net:

BindIp: 127.0.0.1,10.78.200.105

Port: 10000

ProcessManagement:

Fork: true

Replication:

LocalPingThresholdMs: 15

Sharding:

ConfigDB: 10.78.200.105:20000,10.78.200.106:20000,10.78.200.107:20000

ChunkSize: 64

Security:

ClusterAuthMode: keyFile

KeyFile: / app/conf/keyfile

SetParameter:

EnableLocalhostAuthBypass: true

AuthenticationMechanisms: SCRAM-SHA-1

ConnPoolMaxShardedConnsPerHost: 200

ConnPoolMaxConnsPerHost: 5000

$cat shardsvr1_1.conf

SystemLog:

Destination: file

Path: "/ app/logs/sharedsvr1_1.log"

LogAppend: true

Storage:

DbPath: "/ data/mdb/mdb1_1/"

RepairPath: "/ data/mdb/mdb1_1/repair"

Journal:

Enabled: true

CommitIntervalMs: 100

DirectoryPerDB: true

SyncPeriodSecs: 60

Engine: wiredTiger

WiredTiger:

EngineConfig:

CacheSizeGB: 10

JournalCompressor: snappy

DirectoryForIndexes: true

CollectionConfig:

BlockCompressor: snappy

IndexConfig:

PrefixCompression: true

ProcessManagement:

Fork: true

Net:

BindIp: 127.0.0.1,10.78.200.105

Port: 30001

Replication:

OplogSizeMB: 10240

ReplSetName: pns1

Sharding:

ClusterRole: shardsvr

ArchiveMovedChunks: false

Security:

Authorization: disabled

ClusterAuthMode: keyFile

KeyFile: / app/conf/keyfile

SetParameter:

EnableLocalhostAuthBypass: true

AuthenticationMechanisms: SCRAM-SHA-1

ConnPoolMaxShardedConnsPerHost: 200

ConnPoolMaxConnsPerHost: 15000

$cat shardsvr2_2.conf

SystemLog:

Destination: file

Path: "/ app/logs/sharedsvr2_2.log"

LogAppend: true

Storage:

DbPath: "/ data/mdb/mdb2_2/"

RepairPath: "/ data/mdb/mdb2_2/repair"

Journal:

Enabled: true

CommitIntervalMs: 100

DirectoryPerDB: true

SyncPeriodSecs: 60

Engine: wiredTiger

WiredTiger:

EngineConfig:

CacheSizeGB: 10

JournalCompressor: snappy

DirectoryForIndexes: true

CollectionConfig:

BlockCompressor: snappy

IndexConfig:

PrefixCompression: true

ProcessManagement:

Fork: true

Net:

BindIp: 127.0.0.1,10.78.200.105

Port: 30002

Replication:

OplogSizeMB: 10240

ReplSetName: pns2

Sharding:

ClusterRole: shardsvr

ArchiveMovedChunks: false

Security:

Authorization: disabled

ClusterAuthMode: keyFile

KeyFile: / app/conf/keyfile

SetParameter:

EnableLocalhostAuthBypass: true

AuthenticationMechanisms: SCRAM-SHA-1

ConnPoolMaxShardedConnsPerHost: 200

ConnPoolMaxConnsPerHost: 15000

$cat shardsvr3_3.conf

SystemLog:

Destination: file

Path: "/ app/logs/sharedsvr3_3.log"

LogAppend: true

Storage:

DbPath: "/ data/mdb/mdb3_3/"

RepairPath: "/ data/mdb/mdb3_3/repair"

Journal:

Enabled: true

CommitIntervalMs: 100

DirectoryPerDB: true

SyncPeriodSecs: 60

Engine: wiredTiger

WiredTiger:

EngineConfig:

CacheSizeGB: 10

JournalCompressor: snappy

DirectoryForIndexes: true

CollectionConfig:

BlockCompressor: snappy

IndexConfig:

PrefixCompression: true

ProcessManagement:

Fork: true

Net:

BindIp: 127.0.0.1,10.78.200.105

Port: 30003

Replication:

OplogSizeMB: 10240

ReplSetName: pns3

Sharding:

ClusterRole: shardsvr

ArchiveMovedChunks: false

Security:

Authorization: disabled

ClusterAuthMode: keyFile

KeyFile: / app/conf/keyfile

SetParameter:

EnableLocalhostAuthBypass: true

AuthenticationMechanisms: SCRAM-SHA-1

ConnPoolMaxShardedConnsPerHost: 200

ConnPoolMaxConnsPerHost: 15000

106 host environment variables and parameters:

# add by mongoDB#

Export LANG=en_US

Export PATH=$PATH:/app/mongodb_3_2_4/bin

Set-o vi

Stty erase ^ H

Umask 022

Export HISTTIMEFORMAT= `whoami` ":% hash% d -% H:%M:%S"

Export PS1='\ n\ e [1trans37m [\ e32m\ u\ e [1trans33m @\ e [m\ e] [1trans36m\ h\ e [m\ e [4m`pwd`\ e]\ e [m\ e [1ex36m\ e [m\ n\ $'

Alias' l=ls-altr'

Alias' cdm=cd / app/mongodb_3_2_4'

Alias' cdl=cd / app/logs'

Alias' cdc=cd / app/conf'

Alias' cddb=cd / data/'

Alias' mongosstart=numactl-- interleave=all mongos-- config=/app/conf/mongos2.conf'

Alias' configstart=numactl-- interleave=all mongod-- config=/app/conf/configsvr1_2.conf'

Alias' mongodstart1=numactl-- interleave=all mongod-- config=/app/conf/shardsvr1_3.conf'

Alias' mongodstart2=numactl-- interleave=all mongod-- config=/app/conf/shardsvr2_1.conf'

Alias' mongodstart3=numactl-- interleave=all mongod-- config=/app/conf/shardsvr3_2.conf'

Alias "mongosstop=ps-ef | grep-v grep | grep mongos | cut-c 9-15 | xargs kill-2"

Alias "mongodstop=ps-ef | grep-v grep | grep shardsvr | grep mongod | cut-c 9-15 | xargs kill-2"

Alias "mongocfgstop=ps-ef | grep-v grep | grep configsvr | cut-c 9-15 | xargs kill-2"

# add by mongoDB#

[root@vq12stmsg02 conf] # ll

Total 24

-rw-r--r-- 1 mongo dba 859 Mar 24 15:47 configsvr1_2.conf

-rw- 1 mongo dba 1004 Mar 24 11:02 keyfile

-rw-r--r-- 1 mongo dba 527 Mar 24 15:40 mongos2.conf

-rw-r--r-- 1 mongo dba 930 Mar 24 15:47 shardsvr1_3.conf

-rw-r--r-- 1 mongo dba 928 Mar 24 15:48 shardsvr2_1.conf

-rw-r--r-- 1 mongo dba 930 Mar 24 15:48 shardsvr3_2.conf

[root@vq12stmsg02 conf] # cat configsvr1_2.conf

SystemLog:

Destination: file

Path: "/ app/logs/configsvr2_1.log"

LogAppend: true

Storage:

DbPath: "/ data/configdb/configdb2_1"

RepairPath: "/ data/configdb/configdb2_1/repair"

Journal:

Enabled: true

CommitIntervalMs: 100

DirectoryPerDB: true

SyncPeriodSecs: 60

Engine: wiredTiger

WiredTiger:

EngineConfig:

CacheSizeGB: 1

JournalCompressor: snappy

DirectoryForIndexes: true

CollectionConfig:

BlockCompressor: snappy

IndexConfig:

PrefixCompression: true

ProcessManagement:

Fork: true

Net:

BindIp: 127.0.0.1,10.78.200.106

Port: 20000

Sharding:

ClusterRole: configsvr

Security:

Authorization: disabled

ClusterAuthMode: keyFile

KeyFile: / app/conf/keyfile

SetParameter:

EnableLocalhostAuthBypass: true

AuthenticationMechanisms: SCRAM-SHA-1

ConnPoolMaxShardedConnsPerHost: 200

ConnPoolMaxConnsPerHost: 5000

[root@vq12stmsg02 conf] # cat mongos2.conf

SystemLog:

Destination: file

Path: / app/logs/mongos2.log

LogAppend: true

Net:

BindIp: 127.0.0.1,10.78.200.106

Port: 10000

ProcessManagement:

Fork: true

Replication:

LocalPingThresholdMs: 15

Sharding:

ConfigDB: 10.78.200.105:20000,10.78.200.106:20000,10.78.200.107:20000

ChunkSize: 64

Security:

ClusterAuthMode: keyFile

KeyFile: / app/conf/keyfile

SetParameter:

EnableLocalhostAuthBypass: true

AuthenticationMechanisms: SCRAM-SHA-1

ConnPoolMaxShardedConnsPerHost: 200

ConnPoolMaxConnsPerHost: 5000

[root@vq12stmsg02 conf] # cat shardsvr1_3.conf

SystemLog:

Destination: file

Path: "/ app/logs/sharedsvr1_3.log"

LogAppend: true

Storage:

DbPath: "/ data/mdb/mdb1_3/"

RepairPath: "/ data/mdb/mdb1_3/repair"

Journal:

Enabled: true

CommitIntervalMs: 100

DirectoryPerDB: true

SyncPeriodSecs: 60

Engine: wiredTiger

WiredTiger:

EngineConfig:

CacheSizeGB: 10

JournalCompressor: snappy

DirectoryForIndexes: true

CollectionConfig:

BlockCompressor: snappy

IndexConfig:

PrefixCompression: true

ProcessManagement:

Fork: true

Net:

BindIp: 127.0.0.1,10.78.200.106

Port: 30003

Replication:

OplogSizeMB: 10240

ReplSetName: pns1

Sharding:

ClusterRole: shardsvr

ArchiveMovedChunks: false

Security:

Authorization: disabled

ClusterAuthMode: keyFile

KeyFile: / app/conf/keyfile

SetParameter:

EnableLocalhostAuthBypass: true

AuthenticationMechanisms: SCRAM-SHA-1

ConnPoolMaxShardedConnsPerHost: 200

ConnPoolMaxConnsPerHost: 15000

[root@vq12stmsg02 conf] # cat shardsvr2_1.conf

SystemLog:

Destination: file

Path: "/ app/logs/sharedsvr2_1.log"

LogAppend: true

Storage:

DbPath: "/ data/mdb/mdb2_1/"

RepairPath: "/ data/mdb/mdb2_1/repair"

Journal:

Enabled: true

CommitIntervalMs: 100

DirectoryPerDB: true

SyncPeriodSecs: 60

Engine: wiredTiger

WiredTiger:

EngineConfig:

CacheSizeGB: 10

JournalCompressor: snappy

DirectoryForIndexes: true

CollectionConfig:

BlockCompressor: snappy

IndexConfig:

PrefixCompression: true

ProcessManagement:

Fork: true

Net:

BindIp: 127.0.0.1,10.78.200.106

Port: 30001

Replication:

OplogSizeMB: 10240

ReplSetName: pns2

Sharding:

ClusterRole: shardsvr

ArchiveMovedChunks: false

Security:

Authorization: disabled

ClusterAuthMode: keyFile

KeyFile: / app/conf/keyfile

SetParameter:

EnableLocalhostAuthBypass: true

AuthenticationMechanisms: SCRAM-SHA-1

ConnPoolMaxShardedConnsPerHost: 200

ConnPoolMaxConnsPerHost: 15000

[root@vq12stmsg02 conf] # cat shardsvr3_2.conf

SystemLog:

Destination: file

Path: "/ app/logs/sharedsvr3_2.log"

LogAppend: true

Storage:

DbPath: "/ data/mdb/mdb3_2/"

RepairPath: "/ data/mdb/mdb3_2/repair"

Journal:

Enabled: true

CommitIntervalMs: 100

DirectoryPerDB: true

SyncPeriodSecs: 60

Engine: wiredTiger

WiredTiger:

EngineConfig:

CacheSizeGB: 10

JournalCompressor: snappy

DirectoryForIndexes: true

CollectionConfig:

BlockCompressor: snappy

IndexConfig:

PrefixCompression: true

ProcessManagement:

Fork: true

Net:

BindIp: 127.0.0.1,10.78.200.106

Port: 30002

Replication:

OplogSizeMB: 10240

ReplSetName: pns3

Sharding:

ClusterRole: shardsvr

ArchiveMovedChunks: false

Security:

Authorization: disabled

ClusterAuthMode: keyFile

KeyFile: / app/conf/keyfile

SetParameter:

EnableLocalhostAuthBypass: true

AuthenticationMechanisms: SCRAM-SHA-1

ConnPoolMaxShardedConnsPerHost: 200

ConnPoolMaxConnsPerHost: 15000

[root@vq12stmsg02 conf] #

107 host environment variables and parameters:

# add by mongoDB#

Export LANG=en_US

Export PATH=$PATH:/app/mongodb_3_2_4/bin

Set-o vi

Stty erase ^ H

Umask 022

Export HISTTIMEFORMAT= `whoami` ":% hash% d -% H:%M:%S"

Export PS1='\ n\ e [1trans37m [\ e32m\ u\ e [1trans33m @\ e [m\ e] [1trans36m\ h\ e [m\ e [4m`pwd`\ e]\ e [m\ e [1ex36m\ e [m\ n\ $'

Alias' l=ls-altr'

Alias' cdm=cd / app/mongodb_3_2_4'

Alias' cdl=cd / app/logs'

Alias' cdc=cd / app/conf'

Alias' cddb=cd / data/'

Alias' mongosstart=numactl-- interleave=all mongos-- config=/app/conf/mongos3.conf'

Alias' configstart=numactl-- interleave=all mongod-- config=/app/conf/configsvr1_3.conf'

Alias' mongodstart1=numactl-- interleave=all mongod-- config=/app/conf/shardsvr1_2.conf'

Alias' mongodstart2=numactl-- interleave=all mongod-- config=/app/conf/shardsvr2_3.conf'

Alias' mongodstart3=numactl-- interleave=all mongod-- config=/app/conf/shardsvr3_1.conf'

Alias "mongosstop=ps-ef | grep-v grep | grep mongos | cut-c 9-15 | xargs kill-2"

Alias "mongodstop=ps-ef | grep-v grep | grep shardsvr | grep mongod | cut-c 9-15 | xargs kill-2"

Alias "mongocfgstop=ps-ef | grep-v grep | grep configsvr | cut-c 9-15 | xargs kill-2"

# add by mongoDB#

[root@vq12stmsg03 conf] # ll

Total 24

-rw-r--r-- 1 mongo dba 861 Mar 24 15:45 configsvr1_3.conf

-rw- 1 mongo dba 1004 Mar 24 11:02 keyfile

-rw-r--r-- 1 mongo dba 526 Mar 24 15:46 mongos3.conf

-rw-r--r-- 1 mongo dba 930 Mar 24 15:46 shardsvr1_2.conf

-rw-r--r-- 1 mongo dba 930 Mar 24 15:47 shardsvr2_3.conf

-rw-r--r-- 1 mongo dba 930 Mar 24 15:47 shardsvr3_1.conf

[root@vq12stmsg03 conf] # cat configsvr1_3.conf

SystemLog:

Destination: file

Path: "/ app/logs/configsvr3_1.log"

LogAppend: true

Storage:

DbPath: "/ data/configdb/configdb3_1"

RepairPath: "/ data/configdb/configdb3_1/repair"

Journal:

Enabled: true

CommitIntervalMs: 100

DirectoryPerDB: true

SyncPeriodSecs: 60

Engine: wiredTiger

WiredTiger:

EngineConfig:

CacheSizeGB: 1

JournalCompressor: snappy

DirectoryForIndexes: true

CollectionConfig:

BlockCompressor: snappy

IndexConfig:

PrefixCompression: true

ProcessManagement:

Fork: true

Net:

BindIp: 127.0.0.1,10.78.200.107

Port: 20000

Sharding:

ClusterRole: configsvr

Security:

Authorization: disabled

ClusterAuthMode: keyFile

KeyFile: / app/conf/keyfile

SetParameter:

EnableLocalhostAuthBypass: true

AuthenticationMechanisms: SCRAM-SHA-1

ConnPoolMaxShardedConnsPerHost: 200

ConnPoolMaxConnsPerHost: 5000

[root@vq12stmsg03 conf] # cat mongos3.conf

SystemLog:

Destination: file

Path: / app/logs/mongos3.log

LogAppend: true

Net:

BindIp: 127.0.0.1,10.78.200.107

Port: 10000

ProcessManagement:

Fork: true

Replication:

LocalPingThresholdMs: 15

Sharding:

ConfigDB: 10.78.200.105:20000,10.78.200.106:20000,10.78.200.107:20000

ChunkSize: 64

Security:

ClusterAuthMode: keyFile

KeyFile: / app/conf/keyfile

SetParameter:

EnableLocalhostAuthBypass: true

AuthenticationMechanisms: SCRAM-SHA-1

ConnPoolMaxShardedConnsPerHost: 200

ConnPoolMaxConnsPerHost: 5000

[root@vq12stmsg03 conf] # cat shardsvr1_2.conf

SystemLog:

Destination: file

Path: "/ app/logs/sharedsvr1_2.log"

LogAppend: true

Storage:

DbPath: "/ data/mdb/mdb1_2/"

RepairPath: "/ data/mdb/mdb1_2/repair"

Journal:

Enabled: true

CommitIntervalMs: 100

DirectoryPerDB: true

SyncPeriodSecs: 60

Engine: wiredTiger

WiredTiger:

EngineConfig:

CacheSizeGB: 10

JournalCompressor: snappy

DirectoryForIndexes: true

CollectionConfig:

BlockCompressor: snappy

IndexConfig:

PrefixCompression: true

ProcessManagement:

Fork: true

Net:

BindIp: 127.0.0.1,10.78.200.107

Port: 30002

Replication:

OplogSizeMB: 10240

ReplSetName: pns1

Sharding:

ClusterRole: shardsvr

ArchiveMovedChunks: false

Security:

Authorization: disabled

ClusterAuthMode: keyFile

KeyFile: / app/conf/keyfile

SetParameter:

EnableLocalhostAuthBypass: true

AuthenticationMechanisms: SCRAM-SHA-1

ConnPoolMaxShardedConnsPerHost: 200

ConnPoolMaxConnsPerHost: 15000

[root@vq12stmsg03 conf] # cat shardsvr2_3.conf

SystemLog:

Destination: file

Path: "/ app/logs/sharedsvr2_3.log"

LogAppend: true

Storage:

DbPath: "/ data/mdb/mdb2_3/"

RepairPath: "/ data/mdb/mdb2_3/repair"

Journal:

Enabled: true

CommitIntervalMs: 100

DirectoryPerDB: true

SyncPeriodSecs: 60

Engine: wiredTiger

WiredTiger:

EngineConfig:

CacheSizeGB: 10

JournalCompressor: snappy

DirectoryForIndexes: true

CollectionConfig:

BlockCompressor: snappy

IndexConfig:

PrefixCompression: true

ProcessManagement:

Fork: true

Net:

BindIp: 127.0.0.1,10.78.200.107

Port: 30003

Replication:

OplogSizeMB: 10240

ReplSetName: pns2

Sharding:

ClusterRole: shardsvr

ArchiveMovedChunks: false

Security:

Authorization: disabled

ClusterAuthMode: keyFile

KeyFile: / app/conf/keyfile

SetParameter:

EnableLocalhostAuthBypass: true

AuthenticationMechanisms: SCRAM-SHA-1

ConnPoolMaxShardedConnsPerHost: 200

ConnPoolMaxConnsPerHost: 15000

[root@vq12stmsg03 conf] # cat shardsvr3_1.conf

SystemLog:

Destination: file

Path: "/ app/logs/sharedsvr3_1.log"

LogAppend: true

Storage:

DbPath: "/ data/mdb/mdb3_1/"

RepairPath: "/ data/mdb/mdb3_1/repair"

Journal:

Enabled: true

CommitIntervalMs: 100

DirectoryPerDB: true

SyncPeriodSecs: 60

Engine: wiredTiger

WiredTiger:

EngineConfig:

CacheSizeGB: 10

JournalCompressor: snappy

DirectoryForIndexes: true

CollectionConfig:

BlockCompressor: snappy

IndexConfig:

PrefixCompression: true

ProcessManagement:

Fork: true

Net:

BindIp: 127.0.0.1,10.78.200.107

Port: 30001

Replication:

OplogSizeMB: 10240

ReplSetName: pns3

Sharding:

ClusterRole: shardsvr

ArchiveMovedChunks: false

Security:

Authorization: disabled

ClusterAuthMode: keyFile

KeyFile: / app/conf/keyfile

SetParameter:

EnableLocalhostAuthBypass: true

AuthenticationMechanisms: SCRAM-SHA-1

ConnPoolMaxShardedConnsPerHost: 200

ConnPoolMaxConnsPerHost: 15000

Shard / replica set configuration:

Mongo 127.0.0.1:30001

Rs.initiate ()

Rs.add ("10.78.200.107 30002")

Rs.add ("10.78.200.106 30003")

Rs.conf ()

Mongo 127.0.0.1:30001

Rs.initiate ()

Rs.add ("10.78.200.105 purl 30002")

Rs.add ("10.78.200.107 30003")

Rs.conf ()

Mongo 127.0.0.1:30001

Rs.initiate ()

Rs.add ("10.78.200.106 30002")

Rs.add ("10.78.200.105 30003")

Rs.conf ()

Mongo 127.0.0.1:10000

Use admin

Sh.addShard ("pns1/10.78.200.105:30001,10.78.200.107:30002,10.78.200.106:30003")

Sh.addShard ("pns2/10.78.200.106:30001,10.78.200.105:30002,10.78.200.107:30003")

Sh.addShard ("pns3/10.78.200.107:30001,10.78.200.106:30002,10.78.200.105:30003")

Db.runCommand ({listshards:1})

Users and permissions:

Use admin

Db.createUser (

{

User: "admin"

Pwd: "xxxxxx"

Roles: [{role: "root", db: "admin"}, {role: "clusterManager", db: "admin"}, {role: "clusterMonitor", db: "admin"}, {role: "hostManager", db: "admin"}]

}

)

Db.updateUser ("admin"

{

Roles: [{role: "root", db: "admin"}, {role: "dbAdminAnyDatabase", db: "admin"}, {"role": "readWriteAnyDatabase", db: "admin"}, {role: "userAdminAnyDatabase", db: "admin"}, {role: "clusterManager", db: "admin"}, {role: "clusterMonitor", db: "admin"}, {role: "hostManager", db: "admin"}]

}

);

Mongo 10.78.200.107:10000/admin-u admin-p xxxxxx

-db.auth ("admin", "xxxxxx")

Mongo 10.78.200.107:10000/mdb-u pns-p xxxxxx

Mongostat-h 10.78.200.107 xxxxxx 30001-u admin-p xxxxxx-- discover-- authenticationDatabase admin 1

Mongotop-h 10.78.200.107 xxxxxx 30001-u admin-p xxxxxx-- authenticationDatabase admin

Mongo 10.78.200.107 xxxxxx 30001-u pns-p xxxxxx-- eval "printjson (db.printSlaveReplicationInfo ())"

Mongo 127.0.0.1:10000

Use admin

Db.runCommand ({"enablesharding": "mdb"})

Db.runCommand ({"shardcollection": "mdb.mcUser293", "key": {"_ id": "hashed"}})

Db.runCommand ({shardcollection: "mdb.mcUser293", key: {_ id:1}})

Use mdb

For (var iTunes 1)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report