什么是架构
- 集群架构,高并发的时候,从单台机器转换为集群架构
集群中的机器,须要划分角色,分档次
运维日常
- 网站7*24运行,数据不丢,用户体验号,自动化
- 日常故障解决
- 日常查看监控:察看与查看网站状态,分档次的,多维度监控(硬件,零碎,服务,业务)
- 我的项目:不断完善整个网站集群架构,s状况,t指标,a计划/步骤,r(后果,定期汇报)
- 代码上线
- 备份
学习:平安运维,容器架构师(k8s),运维开发,DBA
新建虚拟机
LAN区段 172.16.1.0/24
![上传中...]()
前三位示意VMware- 批改网卡名字为eth0
- 装置界面install 按Tab 输出net.ifnames=0 biosdevnames=0
- 配置网卡:eth0 10.0.0.200 配置网关 dns
- eth1:172.16.1.200
- 设置工夫
- softselect 123 -1
网络排查:1.虚拟机外面配置NAT模式的网端和网关
Linux零碎根底优化
- 配置yum源base,epel
- 装置常用软件
- 敞开防火墙和selinux
- ssh连贯慢解决
- 网络服务敞开NetworkManager 保留network
- 配置工夫同步
- PS1
- hosts解析
配置sudo
敞开防火墙和selinux
#firewalld iptablessystemctl stop firewalldsystemctl disable firewalld#selinux NSA 加强的平安配置#长期批改setenforce 0 getenforce #敞开 disable 或 permissive#永恒批改vim /etc/sysconfig/selinux 或config # This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:# enforcing - SELinux security policy is enforced.# permissive - SELinux prints warnings instead of enforcing.# disabled - No SELinux policy is loaded.SELINUX=disabled# SELINUXTYPE= can take one of three values:# targeted - Targeted processes are protected,# minimum - Modification of targeted policy. Only selected processes are protected.# mls - Multi Level Security protection.SELINUXTYPE=targeted~
配置yum源,base,epel
#配置base源curl -o /etc/yum.repos.d/CentOS-base.repo http://mirrors.aliyun.com/repo/Centos-7.repo#配置epel源curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo#装置必备工具https://www.jianshu.com/p/604b4d79a227
ssh连贯慢解决
ssh服务端配置文件ll /etc/ssh/sshd_config67 # Change to no to disable s/key passwords 68 #ChallengeResponseAuthentication yes 69 ChallengeResponseAuthentication no 70 71 # Kerberos options 72 #KerberosAuthentication no 73 #KerberosOrLocalPasswd yes 74 #KerberosTicketCleanup yes 75 #KerberosGetAFSToken no 76 #KerberosUseKuserok yes 77 78 # GSSAPI options 79 GSSAPIAuthentication yes #把这里的yes改成no 80 GSSAPICleanupCredentials no 81 #GSSAPIStrictAcceptorCheck yes 82 #GSSAPIKeyExchange no 83 #GSSAPIEnablek5users no 84 85 # Set this to 'yes' to enable PAM authentication, account processing, 86 # and session processing. If this is enabled, PAM authentication will 87 # be allowed through the ChallengeResp112 #ClientAliveInterval 0113 #ClientAliveCountMax 3114 #ShowPatchLevel no115 UseDNS no #改成no,相当于不必把IP改成域名116 #PidFile /var/run/sshd.pid117 #MaxStartups 10:30:100118 #PermitTunnel no
批改网卡名
grep linux16 /boot/grub2/grub.cfg [root@xugou ~]# grep linux16 /boot/grub2/grub.cfg linux16 /vmlinuz-3.10.0-1160.el7.x86_64 root=/dev/mapper/centos_xugou-root ro crashkernel=auto rd.lvm.lv=centos_xugou/root rd.lvm.lv=centos_xugou/swap net.ifnames=0 rhgb quiet LANG=en_US.UTF-8 linux16 /vmlinuz-0-rescue-71115aadb21c47f193fee20fc6dd1dd3 root=/dev/mapper/centos_xugou-root ro crashkernel=auto rd.lvm.lv=centos_xugou/root rd.lvm.lv=centos_xugou/swap net.ifnames=0 rhgb quiet 在前面间接加 net.ifnames=0 biosdevnames=0而后把 /etc/sysconfig/network-scripts/ifcfg-ens33改成ifcfg-ens0再进入到这个文件内批改NAME和DEVICENAME
敞开NetworkManager
systemctl stop NetworkManagersystemctl disable NetworkManager
配置工夫同步 定时工作
ntpdate
PS1
export PS1='[\[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\\$ '
vim /etc/profile
这里把前面的W改成w就能够变成绝对路径
永恒失效用source /etc/profile
hosts解析
- 在一个局域网中通过主机名 相互拜访
- 内网搭建的外部DNS服务(服务器数量微小)
- 服务器数量不多-批改/etc/hosts文件写入 解析记录
配置ip地址与主机名对应关系,相似于DNS
配置sudo
[root@xugou ~]$ grep wheel /etc/sudoers## Allows people in group wheel to run all commands%wheel ALL=(ALL) ALL# %wheel ALL=(ALL) NOPASSWD: ALL
防火墙
- 硬件: 深服气,3层路由
软件:firewlld,iptables
负载平衡,散发申请
- 硬件:F5,A10,Redware
软件:nginx,haproxy,lvs
web服务器,寄存代码
nginx,apache,tengine
数据库
寄存用户数据
- oracle
- mysql
MongoDB
存储:寄存用户上传的数据
- 软件NFS
- glusterFS
- Ceph
硬件:EMC(dell)
缓存
redis 缓存数据库内容,会话共享
一些日志文件
cat ~/.bash_history
/var/log/secure
/var/log/messages运维人员登录
- 只能通过openvpn 登录
- 通过堡垒机
- zabbix+grafana
- 批量治理ansible/pssh
日志剖析/收集平台 ELK 监控整个集群
开发角度
- github
- 测试通过jenkins
代码品质管理工具 sonarcube
底层架构
服务器布局
主机IP地址布局