1024programmer Java Linux (Ubuntu) environment construction, basic framework, summary (mongo replica set, redis…)

Linux (Ubuntu) environment construction, basic framework, summary (mongo replica set, redis…)

Save screenshots:

The mongo replica set is written separately:

1. Create the corresponding conf file

/etc/mongos/mongod1.conf

/etc/mongos/mongod2.conf

/etc/mongos/mongod3.conf

2. Create corresponding data files

/mongodata/data1

/mongodata/data2

/mongodata/data3

3. Start mongo as a replica set (Stop adding –shutdown)

Mongod–f /etc/mongos/mongod1.conf –replSetrs1

Mongod–f /etc/mongos/mongod2.conf –replSetrs1

Mongod–f /etc/mongos/mongod3.conf –replSetrs1

4. Log in to one (you hope it is the primary one)

mongo 192.168.1.226:27017

User admin

cOnfig={

“_id” : “rs1”,

“members” : [

                                                          

“_id” : 0,

“host” : “192.168.1.226:27017”

               },

                                                          

“_id” : 1,

“host” : “192.168.1.226:27017”

               },

                                                          

“_id” : 2,

“host” : “192.168.1.226:27017”

                                                                                                                                 

]

}

rs.initiate(config)

rs.status()//Check the situation

Arbitration node Configuration example : “host” : “192.168.1.226:27017”, arbiterOnly: true; The arbiter node can be used as long as you Even if the machine is down, there are still two available


This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/linux-ubuntu-environment-construction-basic-framework-summary-mongo-replica-set-redis/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: 34331943@QQ.com

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索