什么是架构
- 集群架构,高并发的时候,从单台机器转换为集群架构
集群中的机器,需要划分角色,分层次
运维日常
- 网站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 iptables systemctl stop firewalld systemctl 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_config
67 # 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 ChallengeResp
112 #ClientAliveInterval 0
113 #ClientAliveCountMax 3
114 #ShowPatchLevel no
115 UseDNS no #改成no,相当于不用把IP改成域名
116 #PidFile /var/run/sshd.pid
117 #MaxStartups 10:30:100
118 #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 NetworkManager
systemctl 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地址规划
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。