BSN-DDC 기본 네트워크에 대한 자세한 설명(12): Computing Power Center 개발자 포털 배포 지침(2)

05

환경 준비

환경 검증

검증 명령을 출력하고 출력 결과를 표시하며 네트워크를 포함한 기본 환경에서 확인해야 함

하드웨어 환경 검증

CPU 코어 검증

cat /proc/cpuinfo | grep -i "model name" | wc -l

메모리 크기 확인

free -h

디스크 크기 확인

df -h

출력 결과:

[root@localhost ~]# cat /proc/cpuinfo | grep -i "model name" | wc -l
4
[root@localhost ~]# free -h      
              total        used        free      shared  buff/cache   available
Mem:            15G        262M         13G         16M        2.1G         14G
Swap:            0B          0B          0B
[root@localhost ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p1   30G  7.9G   23G  27% /
devtmpfs        7.7G     0  7.7G   0% /dev
tmpfs           7.7G     0  7.7G   0% /dev/shm
tmpfs           7.7G   17M  7.7G   1% /run
tmpfs           7.7G     0  7.7G   0% /sys/fs/cgroup
/dev/nvme1n1p1  200G   33M  200G   1% /bsn
tmpfs           1.6G     0  1.6G   0% /run/user/1018
시스템 기본 환경 검증

시스템 배포, 커널, CPU 아키텍처 검증

cat /etc/os-release 
cat /etc/redhat-release
uname -r
uname -m

출력 결과:

[root@localhost ddc-back-service]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

[root@localhost ddc-back-service]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core) 
[root@localhost ddc-back-service]# uname -r
3.10.0-862.3.2.el7.x86_64
[root@localhost ddc-back-service]# uname -m
x86_64

도커 확인

docker version

출력 결과:

[root@localhost ~]# docker version
Client: Docker Engine - Community
  Version:           23.0.1 
  API version:       1.42 
  Go version:        go1.19.5 
  Git commit:        a5ee5b1 
  Built:             Thu Feb  9 19:51:00 2023 
  OS/Arch:           linux/amd64 
  Context:           default
  
Server: Docker Engine - Community 
  Engine:
    Version:          23.0.1  
    API version:      1.42 (minimum version 1.12)  
    Go version:       go1.19.5  
    Git commit:       bc3805a  
    Built:            Thu Feb  9 19:48:42 2023  
    OS/Arch:          linux/amd64  
    Experimental:     false 
    containerd:  
    Version:          1.6.18  
    GitCommit:        2456e983eb9e37e47538f59ea18f2043c9a73640 
   runc:  
    Version:          1.1.4  
    GitCommit:        v1.1.4-0-g5fd4c4d
   docker-init:  
    Version:          0.19.0  
    GitCommit:        de40ad0

도커 작성 확인

docker compose version

출력 결과:

[root@localhost ~]# docker compose version
Docker Compose version v2.16.0

환경 구성

총 30분

시스템 파라미터 최적화

/etc/sysctl.conf 파일을 수정해야 합니다.

sudo sh -c 'cat >> /etc/sysctl.conf <<EOF
fs.inotify.max_user_watches=100000
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_ignore_bogus_error_responses = 1
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 30
net.ipv4.ip_local_port_range = 1024    65000
net.core.somaxconn = 65535
vm.overcommit_memory = 1
EOF'

출력 결과

[root@localhost ~]# sudo vim /etc/sysctl.conf
You have new mail in /var/spool/mail/root
[root@localhost ~]# cat /etc/sysctl.conf
fs.inotify.max_user_watches=100000
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_ignore_bogus_error_responses = 1
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 30
net.ipv4.ip_local_port_range = 1024    65000
net.core.somaxconn = 65535
vm.overcommit_memory = 1

커널 매개변수를 즉시 적용

sysctl -p

투명한 거대한 페이지 메모리 구성 비활성화

일시적으로 유효

sudo echo never > /sys/kernel/mm/transparent_hugepage/enabled

영구적으로 적용, 부팅 자동 시작 추가

sudo echo "echo never > /sys/kernel/mm/transparent_hugepage/enabled" >> /etc/rc.local

실행 권한 부여

sudo chmod +x /etc/rc.local

전체 출력

[root@localhost ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
[root@localhost ~]# cat /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
echo never > /sys/kernel/mm/transparent_hugepage/enabled

사용자 파일 오픈 횟수 최적화

추가 구성

sudo sh -c 'sudo cat >> /etc/security/limits.conf <<EOF
* soft nofile 65535
* hard nofile 65535
root soft nofile 102400
root hard nofile 102400
EOF'

출력 결과

cat /etc/security/limits.conf
* soft nofile 65535
* hard nofile 65535
root soft nofile 102400
root hard nofile 102400

마운트 데이터 디스크

데이터 디스크는 독립적으로 마운트해야 합니다.

docker-ce 구성

Alibaba Cloud는 Docker-CE를 설치합니다.

https://developer.aliyun.com/article/110806

daemon.json 파일 편집

sudo sh -c 'sudo cat >/etc/docker/daemon.json <<EOF
{
"registry-mirrors": ["http://f1361db2.m.daocloud.io"],
"data-root": "/bsn/docker",
"log-driver": "json-file",
"log-opts": {"max-size":"500m", "max-file":"3"}
}
EOF'

출력 결과

cat /etc/docker/daemon.json
{
"registry-mirrors": ["http://hub-mirror.c.163.com"],
"data-root": "/bsn/docker",
"log-driver": "json-file",
"log-opts": {"max-size":"500m", "max-file":"3"}
}

도커 구성을 한 번 로드

sudo systemctl daemon-reload

도커 시작

sudo systemctl start docker

부팅 시 docker가 자동으로 시작되도록 설정

sudo systemctl enable docker

NTP 시계 서비스

시간대를 아시아/상하이로 설정

tzselect <<EOF
5
9
1
1
EOF
rm -f /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

NTP 서비스 설치

yum -y install ntp

/etc/ntp.conf 파일을 편집하여 시간 서버 구성을 수정합니다.

sudo sed -i  "s/^server/#server/g" /etc/ntp.conf
sudo sh -c "sudo cat >>/etc/ntp.conf<<EOF
server ntp1.aliyun.com iburst
server ntp2.aliyun.com iburst
server ntp3.aliyun.com iburst
server ntp4.aliyun.com iburst
EOF"

서비스 재시작

systemctl restart ntpd

검증 결과

[root@localhost ~]# ntpq -p
      remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+120.25.115.20   10.137.53.7      2 u   32   64    1   56.627   -4.297   0.088
*203.107.6.88    10.137.38.86     2 u   31   64    1   43.631    9.504   0.154

방화벽 끄기

방화벽 닫기

systemctl stop firewalld
systemctl disable firewalld

셀리운스 닫기

setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

네트워크 인증

서비스 오픈 포트 확인(배포 완료 후 재확인)

외부 네트워크가 정상적으로 통신하는지 확인

ping -c 1 114.114.114.114
telnet www.bsnbase.com 443

출력 결과:

[root@localhost]# ping -c 1 www.baidu.com
PING www.a.shifen.com (x.x.x.x) 56(84) bytes of data.
64 bytes from x.x.x.x (x.x.x.x): icmp_seq=1 ttl=43 time=34.7 ms

--- www.a.shifen.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 34.723/34.723/34.723/0.000 ms
[root@localhost]# telnet www.bsnbase.com 443
Trying x.x.x.x...
Connected to www.bsnbase.com.
Escape character is '^]'.
^]
telnet> quit
Connection closed.

서버 자신의 공용 네트워크 IP 확인

curl cip.cc

출력 결과:

[root@localhost ~]# curl cip.cc
IP        : x.x.x.x
地址        : 美国  美国

数据二        : 美国

数据三        : 中国宁夏中卫市 | 移动

URL        : http://www.cip.cc/x.x.x.x

서버가 인트라넷 IP를 통해 정상적으로 통신하는지 확인

[root@localhost ~]# curl cip.cc
IP        : x.x.x.x
地址        : 美国  美国

数据二        : 美国

数据三        : 中国宁夏中卫市 | 移动

URL        : http://www.cip.cc/x.x.x.x

내용은 "BSN-DDC 기본 네트워크 도움말 설명서"에서 인용, 설명서 버전 번호: 2.2.1, 개정 시간: 2023-04

-끝-

Guess you like

Origin blog.csdn.net/BSN_yanxishe/article/details/130882806