关于程序员:云计算学习days15架构

1次阅读

共计 3521 个字符,预计需要花费 9 分钟才能阅读完成。

什么是架构

  • 集群架构,高并发的时候,从单台机器转换为集群架构
  • 集群中的机器,须要划分角色,分档次

    运维日常

  • 网站 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 地址布局

正文完
 0