In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
# update by csc 20170217
# opensystem centos 6.5 64 bit
Tar-xvzf mongodb-linux-x86_64-rhel62-3.4.2.gz-C / usr/local/
Mv / usr/local/mongodb-linux-x86_64-rhel55-3.4.2 / usr/local/mongodb
Echo 'export PATH=$PATH:/usr/local/mongodb/bin' > > / etc/profile
Source / etc/profile
= =
Mkdir-p / data/mongodb/config/data
Mkdir-p / data/mongodb/config/log
Mkdir-p / data/mongodb/mongos/log
Mkdir-p / data/mongodb/shard1/data
Mkdir-p / data/mongodb/shard1/log
Mkdir-p / data/mongodb/shard2/data
Mkdir-p / data/mongodb/shard2/log
It should be configured if the alarm is started; /
Echo 0 > / proc/sys/vm/zone_reclaim_mode
Echo never > / sys/kernel/mm/transparent_hugepage/enabled
Echo never > / sys/kernel/mm/transparent_hugepage/defrag
Cat > > / etc/rc.d/rc.local/sys/kernel/mm/transparent_hugepage/enabled
Echo never > / sys/kernel/mm/transparent_hugepage/defrag
EOF
# production keyFile documents (authentication use-account management)
# openssl rand-base64 753
Copy string to / usr/local/mongodb/key
Chmod 600 / root/mobgodb/key
And copy the key file to the same directory of the other two nodes
# #
/ usr/local/mongodb/bin/mongod-configsvr-replSet cfgReplSet-dbpath / data/mongodb/config/data-port 21000-logpath / data/mongodb/config/log/config.log-fork-keyFile / usr/local/mongodb/key
/ usr/local/mongodb/bin/mongod-shardsvr-replSet shard1-port 22001-dbpath / data/mongodb/shard1/data-logpath / data/mongodb/shard1/log/shard1.log-fork-oplogSize 10000-keyFile / usr/local/mongodb/key
/ usr/local/mongodb/bin/mongod-shardsvr-replSet shard2-port 22002-dbpath / data/mongodb/shard2/data-logpath / data/mongodb/shard2/log/shard2.log-fork-oplogSize 10000-keyFile / usr/local/mongodb/key
/ usr/local/mongodb/bin/mongos-configdb cfgReplSet/192.168.1.15:21000192.168.1.16:21000192.168.1.17:21000-port 30000-logpath / data/mongodb/mongos/log/mongos.log-fork-keyFile / usr/local/mongodb/key
=
Mongo 192.168.1.15:21000
Use admin
Config = {_ id: "cfgReplSet", members: [
{_ id:0,host: "192.168.1.15purl 21000"}
{_ id:1,host: "192.168.1.16purl 21000"}
{_ id:2,host: "192.168.1.17purl 21000"}
]
}
Rs.initiate (config)
=
Mongo 192.168.1.15:22001
Use admin
Config = {_ id: "shard1", members: [
{_ id:0,host: "192.168.1.15 22001", priority:2}
{_ id:1,host: "192.168.1.16 22001", priority:1}
{_ id:2,host: "192.168.1.17 22001", arbiterOnly:true}
]
}
Rs.initiate (config)
=
Mongo 192.168.1.16:22002
Use admin
Config = {_ id: "shard2", members: [
{_ id:0,host: "192.168.1.15 22002", priority:1}
{_ id:1,host: "192.168.1.16 id:1,host 22002", priority:2}
{_ id:2,host: "192.168.1.17 22002", arbiterOnly:true}
]
}
Rs.initiate (config)
=
Mongo 192.168.1.15:30000
Use admin
Concatenation-add-routing server and allocation replica set 1
Db.runCommand ({addshard: "shard1/192.168.1.15:22001192.168.1.16:22001192.168.1.17:22001"})
Concatenation-add-routing server and allocation replica set 2
Db.runCommand ({addshard: "shard2/192.168.1.15:22002192.168.1.16:22002192.168.1.17:22002"})
#
# # creating an account
Mongos 192.168.1.15:30000
# # create a super administrative user password root/12345
Use admin
Db.createUser (
{
User: "root"
Pwd: "12345"
Roles: [{role: "userAdminAnyDatabase", db: "admin"}]
}
)
# View
Show users
# # #
# create the account password of the database portal/123456 Database: WHTY_EDU_469026
Use WHTY_EDU_469026
Db.createUser (
{
User: "portal"
Pwd: "123456"
Roles: [
{role: "readWrite", db: "WHTY_EDU_469026"}
]
}
)
# View
Show users
# Link method 1:
# mongo-u portal-p 123456 127.0.0.1:30000/WHTY_EDU_469026
# Link method 2:
Use admin
Db.auth ("portal", "123456") # authentication. A return of 1 indicates success.
# deleting an account
Log in with your admin account, and then use the database
Execute db.dropuser ("portal")
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.