1. Installation environment
-
Pay attention to the IP address when installing the operating system
-
The installation of the operating system is the same as the first time, and the IP addresses will be automatically assigned consecutively, so do not change the network configuration.
-
reference:
VMware installation Centos7 ultra-detailed process (graphic): https://blog.csdn.net/babyxue/article/details/80970526
Install and run MongoDB on Linux: https://blog.csdn.net/yzh_1346983557/article/details/81735755
-
-
change hostname
-
Check the hostname: hostnamectl
-
Permanently modify the hostname: hostnamectl set-hostname xxx
-
Restart to take effect: reboot
-
reference:
View and modify CentOS7 host name https://blog.csdn.net/Frankltf/article/details/82976506
-
2. Experimental operation
-
Step 1.2 is operated under nosql01
-
Create directory before 1.1 step 2
- mkdir -p /opt/servers/mongodb_demo/
- mkdir -p /opt/software/
- This directory is at the same level as root
-
When operating step 2 of 1.1, do not copy when executing the change permission command. In the document, some symbols are wrong, try to type them by hand.
-
Note: Minus sign '-', colon ':' , space ' ', underscore '_'
-
Make sure all file permissions in /opt/servers/mongodb_demo are user_mongo
-
View permission command: ll
-
Command explanation:
chown -R username: group name./ and chown usage introduction: https://blog.csdn.net/jinpengncu/article/details/77879844?ops_request_misc=%257B%2522request%255Fid%2522%253A%25221638665512167803665829 56%2522% 252C%2522scm%2522%253A%252220140713.130102334…%2522%257D&request_id=163866551216780366582956&biz_id=0&utm_medium=distribute.pc_search_result.none-task-b log-2 all sobaiduend~default-2-77879844.first_rank_v2_pc_rank_v29&utm_term=chown%3A+%E6%97 % A0 %E6%95%88%E7%9A%84%E7%94%A8%E6%88%B7%3A+%22%E2%80%93R%22%0A++++++++++++ ++++++++++++++&spm=1018.2226.3001.4187
-
If there is still an error, try changing the permission to 777
-
reference:
scp 文件 : /目录: Permission denied:https://blog.csdn.net/qq_36743482/article/details/78266308?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522163867195316780366577174%2522%252C%2522scm%2522%253A%252220140713.130102334…%2522%257D&request_id=163867195316780366577174&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2blogsobaiduend~default-1-78266308.pc_v2_rank_blog_default&utm_term=scp%3A+Permission+denied&spm=1018.2226.3001.4450
-
-
-
Step 3 of step 1.2 can be directly operated in the folder under the GUI interface without executing the sudo command.
-
The sudo command may report "user_mongo is not in the sudoers file. This will be reported." error.
-
implement
su root
visado
-
turn up
##Allow root to run any commands anywhere
root ALL=(ALL) ALL
-
Add in the next line: user_mongo ALL=(ALL) ALL
-
reference:
About "The user is not in the sudoers file. This matter will be reported." Solution in Linux: https://blog.csdn.net/mall_lucy/article/details/104885178
-
-
Start MongoDB
-
nosql01 start
./mongod --replSet itcast \
–dbpath=/opt/servers/mongodb_demo/replicaset/data/
–logpath=/opt/servers/mongodb_demo/replicaset/logs/mongodb.log
–port 27017 --bind_ip nosql01 --logappend -
nosql02 start
Change: –bind_ip nosql02
-
nosql03 start
改:–bind_ip nosql03
-
Start a separate terminal for database operations
-
-
2.3 Step 2 The process number is the number in the second column
-
reference:
The specific meaning of ps -ef output https://blog.csdn.net/tanga842428/article/details/72874769?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522163867711716780271971456%2522%2 52C%2522scm%2522%253A %252220140713.130102334.pc%255Fblog.%2522%257D&request_id=163867711716780271971456&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2 blog first_rank _v2~rank_v29-1-72874769.pc_v2_rank_blog_default & utm_term=ps±ef+%7C+grep+mongodb&spm=1018.2226. 3001.4450
-