In the third stage, set up firewall on Day10, install Linux, build MySQL Cluster database hot deployment, master-slave mount

Half bump 2020-11-09 10:50:31
stage set firewall day10 day


1. About server retrieval instructions

1.1 retrieval java Program

command : jps
 Insert picture description here

Close the process :

  1. kill PID Number “ The humble killing process ” If the current process item is used by another process , It doesn't shut down .
  2. kill -15 PID Number “ Gently kill ” You can do the aftermath before you're killed
  3. kill -9 PID Number Force to kill

1.2 Retrieve any program

command : ps -ef | grep xxxx The service name
explain : ps -ef Means to get the current Linux All the service information in the system . “|” Pass the result of the query before the pipeline as a parameter to the following operation .
Example :
 Insert picture description here
 Insert picture description here

1.3 About the firewall

1). Check the open ports of the firewall

`firewall-cmd --list-ports`

2). Check that the port is open

`firewall-cmd --query-port 80/tcp`
* 1

 Insert picture description here
3). Turn on the firewall

`firewall-cmd --zone=public --add-port=80/tcp --permanent`

 Insert picture description here
4). Remove port

 `firewall-cmd --zone=public --remove-port=9090/tcp --permanent`
* 1

 Insert picture description here
5). An explanation of firewall operation
–zone # Scope

–add-port=80/tcp # Add port , The format is : port / Communication protocol

–remove-port=80/tcp # Remove port , The format is : port / Communication protocol

–permanent # permanent , Failure after restart without this parameter

6). service iptables restart

`firewall-cmd --reload`

 Insert picture description here

2.Linux install Nginx The server

2.1 Linux Project deployment diagram

 Insert picture description here

2.2 Nginx install

2.2.1 Linux download nginx The server

 Insert picture description here

2.2.2 Upload Nginx The server

 Insert picture description here

2.2.3 decompression nginx

command : [root@localhost src]# tar -zxvf nginx-1.19.3.tar.gz
 Insert picture description here

2.2.4 nginx Directory structure problem

nginx There is 2 Directory structure :
1. Source directory be responsible for nginx Installation edit Wait for the operation .
 Insert picture description here
Installation command :

  1. [root@localhost nginx]# ./configure
  2. make
  3. make install

 Insert picture description here

`2. working directory be responsible for nginx Reverse proxy and other configuration ....
/usr/local/nginx`

2.2.5 nginx command

explain :nginx The directory should be in “/usr/local/nginx”
 Insert picture description here
command :
Get into sbin After the catalog , Carry out relevant operations
 Insert picture description here
command :

 `./nginx start-up nginx
./nginx -s reload restart nginx
./nignx -s stop stop it nginx`

Start the effect test :
 Insert picture description here

2.3 Linux nginx Implement reverse proxy / Load balancing

2.3.1 Implement domain name proxy

demand : Require users to pass http://manage.jt.com The way to visit ...
 Insert picture description here

2.3.2 To configure nginx The server

explain : modify In the working directory nginx after Keep the profile . After the restart nginx that will do

 `#1. To configure Linux colony
server {
listen 80;
server_name manage.jt.com;
location / {
proxy_pass http://tomcats;
}
}
upstream tomcats {
server 192.168.126.129:8081;
server 192.168.126.129:8082;
}
# To configure Linux Picture agent
server {
listen 80;
server_name image.jt.com;
location / {
# Configure the image disk address .
root /usr/local/src/images;
}
}`

 Insert picture description here

3.Linux Mysql Cluster building

3.1 preview IP Address modification

3.1.1 Modify virtual machine MAC Address

When you create a new virtual machine , modify mac network address .
 Insert picture description here

3.1.2 Check IP Address

command : ip addr
without IP The display performs the following commands

`service NetworkManager stop
chkconfig NetworkManager off Permanent ban Manager network card
service network restart restart network network card `

3.1.3 modify IP Address

1). find IP Directory of addresses

`cd /etc/sysconfig/network-scripts/`

2). modify IP Address .

 `vim ifcfg-ens33`

 Insert picture description here
After the modification is completed Save to exit .
 Insert picture description here
3). Restart NIC Check IP Is the address correct
 Insert picture description here

3.2 Why we need to build Mysql colony

describe : If a single database is used in the project , If the equipment is damaged due to irresistible factors , Data loss , Will directly affect the use of users . It needs to be optimized .
 Insert picture description here

3.3 Database backup mode

3.3.1 Database cold backup

explain : regular Pass the files in the database through sql The way to dump . Ensure that the data is backed up within a certain period of time .
shortcoming : Because it's a regular backup , So it may lead to the loss of data .
Cold backup of database Is the last effective way to recover data . So it continues to use .
 Insert picture description here

3.3.2 Database hot backup

explain : Because the database synchronization operation is very frequent in the work , So as a database developer , Also designed how to synchronize the database .
 Insert picture description here
The steps of synchronization :

  1. If the master database needs to start the synchronization strategy , The binary log file must be opened .( It's off by default .)
  2. When the user " to update " Database time , The main database will write the update information to the binary log file . ( The main database task ends )
  3. From the library will use IO The thread reads the updated binary log file in the main library .
  4. IO The thread will read the information using asynchronous First save to the relay log .( Relay a medium for temporary storage of data )
  5. SQL The thread will read the information in the relay log , After the sql Statements are synchronized to the slave database . At this point, the master-slave synchronization is realized …

4 Realize the construction of master-slave database

4.1 Open the main library binary file

command : vim /etc/my.cnf
 Insert picture description here
 Insert picture description here

4.2 Restart the database

explain : After modifying the configuration file , Need to restart the database , Make the binaries work .
 Insert picture description here

4.3 Configure from database

explain : According to the configuration information of the master database Configure from database As shown in the figure Once the configuration is complete , Restart the database
 Insert picture description here
 Insert picture description here

4.4 Realize the mount of master-slave

Main library : 192.168.126.129 master
Slave Library : 192.168.126.130 slave

4.4.1 Check the master database status information

 Insert picture description here

4.4.2 Realize the master-slave mount

 Insert picture description here

4.4.3 Instructions for resetting binary log files

Problem description : Sometimes after restarting the host many times , Will generate multiple binary file information . As shown in the figure
 Insert picture description here
Solution : Delete extra binary log files , Then restart the database
 Insert picture description here
Then mount it again

Homework

1. Realization Linux Project deployment
129: 8081/8082/8083
130: 8081/8082/8083
requirement : be-all tomcat All servers should be linked to the master database matters needing attention Link to the main library IP Address .

  1. Deploy 2 From the database 129 host 130/131 from The structure of one master and two slaves .
  2. Yes bug About pictures Temporary neglect Why does this happen …
版权声明
本文为[Half bump]所创,转载请带上原文链接,感谢

  1. 【计算机网络 12(1),尚学堂马士兵Java视频教程
  2. 【程序猿历程,史上最全的Java面试题集锦在这里
  3. 【程序猿历程(1),Javaweb视频教程百度云
  4. Notes on MySQL 45 lectures (1-7)
  5. [computer network 12 (1), Shang Xuetang Ma soldier java video tutorial
  6. The most complete collection of Java interview questions in history is here
  7. [process of program ape (1), JavaWeb video tutorial, baidu cloud
  8. Notes on MySQL 45 lectures (1-7)
  9. 精进 Spring Boot 03:Spring Boot 的配置文件和配置管理,以及用三种方式读取配置文件
  10. Refined spring boot 03: spring boot configuration files and configuration management, and reading configuration files in three ways
  11. 精进 Spring Boot 03:Spring Boot 的配置文件和配置管理,以及用三种方式读取配置文件
  12. Refined spring boot 03: spring boot configuration files and configuration management, and reading configuration files in three ways
  13. 【递归,Java传智播客笔记
  14. [recursion, Java intelligence podcast notes
  15. [adhere to painting for 386 days] the beginning of spring of 24 solar terms
  16. K8S系列第八篇(Service、EndPoints以及高可用kubeadm部署)
  17. K8s Series Part 8 (service, endpoints and high availability kubeadm deployment)
  18. 【重识 HTML (3),350道Java面试真题分享
  19. 【重识 HTML (2),Java并发编程必会的多线程你竟然还不会
  20. 【重识 HTML (1),二本Java小菜鸟4面字节跳动被秒成渣渣
  21. [re recognize HTML (3) and share 350 real Java interview questions
  22. [re recognize HTML (2). Multithreading is a must for Java Concurrent Programming. How dare you not
  23. [re recognize HTML (1), two Java rookies' 4-sided bytes beat and become slag in seconds
  24. 造轮子系列之RPC 1:如何从零开始开发RPC框架
  25. RPC 1: how to develop RPC framework from scratch
  26. 造轮子系列之RPC 1:如何从零开始开发RPC框架
  27. RPC 1: how to develop RPC framework from scratch
  28. 一次性捋清楚吧,对乱糟糟的,Spring事务扩展机制
  29. 一文彻底弄懂如何选择抽象类还是接口,连续四年百度Java岗必问面试题
  30. Redis常用命令
  31. 一双拖鞋引发的血案,狂神说Java系列笔记
  32. 一、mysql基础安装
  33. 一位程序员的独白:尽管我一生坎坷,Java框架面试基础
  34. Clear it all at once. For the messy, spring transaction extension mechanism
  35. A thorough understanding of how to choose abstract classes or interfaces, baidu Java post must ask interview questions for four consecutive years
  36. Redis common commands
  37. A pair of slippers triggered the murder, crazy God said java series notes
  38. 1、 MySQL basic installation
  39. Monologue of a programmer: despite my ups and downs in my life, Java framework is the foundation of interview
  40. 【大厂面试】三面三问Spring循环依赖,请一定要把这篇看完(建议收藏)
  41. 一线互联网企业中,springboot入门项目
  42. 一篇文带你入门SSM框架Spring开发,帮你快速拿Offer
  43. 【面试资料】Java全集、微服务、大数据、数据结构与算法、机器学习知识最全总结,283页pdf
  44. 【leetcode刷题】24.数组中重复的数字——Java版
  45. 【leetcode刷题】23.对称二叉树——Java版
  46. 【leetcode刷题】22.二叉树的中序遍历——Java版
  47. 【leetcode刷题】21.三数之和——Java版
  48. 【leetcode刷题】20.最长回文子串——Java版
  49. 【leetcode刷题】19.回文链表——Java版
  50. 【leetcode刷题】18.反转链表——Java版
  51. 【leetcode刷题】17.相交链表——Java&python版
  52. 【leetcode刷题】16.环形链表——Java版
  53. 【leetcode刷题】15.汉明距离——Java版
  54. 【leetcode刷题】14.找到所有数组中消失的数字——Java版
  55. 【leetcode刷题】13.比特位计数——Java版
  56. oracle控制用户权限命令
  57. 三年Java开发,继阿里,鲁班二期Java架构师
  58. Oracle必须要启动的服务
  59. 万字长文!深入剖析HashMap,Java基础笔试题大全带答案
  60. 一问Kafka就心慌?我却凭着这份,图灵学院vip课程百度云