STEC-deployment
服务器初始化配置
每个目录的磁盘使用情况
查看当前服务器磁盘情况,home目录所在磁盘大小
df -h示例输出:
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 32G 0 32G 0% /dev
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 32G 11M 32G 1% /run
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/mapper/centos-root 192G 3.1G 189G 2% /
/dev/mapper/vg_data-data 1000G 595M 999G 1% /data
/dev/vda1 297M 137M 161M 46% /boot
tmpfs 6.3G 0 6.3G 0% /run/user/0可以看到/data目录下分配了1000G硬盘空间。
查看并卸载OpenJDK
查看JDK版本(OpenJDK需要删除)
java -version示例输出:
[root@localhost ~]# java -version
java version "1.8.0_281"
Java(TM) SE Runtime Environment (build 1.8.0_281-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.281-b09, mixed mode)搜索已安装的Java包:
rpm -qa | grep java如果搜索到OpenJDK的包,则对其执行卸载命令:
rpm -e --nodeps java-1.8.0-openjdk-1.8.0.161-2.b14.el7.x86_64
rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.161-2.b14.el7.x86_64
java -version修改文件描述符限制
在/etc/security/limits.conf中添加:
* soft nofile 65535
* hard nofile 65535修改 /etc/sysctl.conf, 加入:
fs.file-max = 6553560重启生效:
rebootDetails
设置的方式有两种,一种是临时生效,重启后恢复默认。另一种永久生效。
file-max 的修改:
echo 6553560 > /proc/sys/fs/file-max
sysctl -w "fs.file-max=34166"
// 以上 2 种重启机器后会恢复为默认值
或
echo "fs.file-max = 6553560" >> /etc/sysctl.conf
// 立即生效,此方式永久生效
sysctl -p重启系统后生效:
* soft noproc 65535
* hard noproc 65535
* soft nofile 65535
* hard nofile 65535临时启动:
ulimit -a
ulimit -n 655350关机:
shutdown -h 0重启后检查:
ulimit -a示例输出:
[root@localhost ~]# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 256820
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 65535
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 256820
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited防火墙设置
查看防火墙状态:
systemctl status firewalld防火墙禁用/可用:
systemctl stop firewalld
systemctl disable firewalld在停止防火墙后,设置防火墙不可用。
开启防火墙:
systemctl start firewalld开放端口3306:
firewall-cmd --zone=public --add-port=3306/tcp --permanent常用命令
所有者(chown -R 用户名称 目录名称)
chown -R root:root /data/cjxx/soft/nginx/conf
chown -R zhgs:zhgs /data/cjxx/soft/nginx/conf
tail -100f logs/stec-devops.log
netstat -lntp | grep 6379
ps -ef | grep
vi /opt/nginx/conf/nginx.conf按esc,输入::
q: 退出
wq: 保存并退出应用安装
创建统一安装目录
注意:目前需要安装在/data目录下(/home目录会有权限问题)
mkdir /data
mkdir /data/scripts
mkdir /data/soft
mkdir /data/apps_view
mkdir /data/apps_jar
mkdir /data/server
mkdir /data/server/static-file应用安装
上传sh安装脚本到/data/scripts并赋予执行权限。
安装JDK
cd /data/scripts
chmod +x jdk-install.sh
sh -x jdk-install.sh
source /etc/profile检查安装是否成功:
java -version安装Redis
(需要在sh脚本中指定密码,默认: Suog@redis.yourip)
cd /data/scripts
chmod +x redis-install-6.2.13.sh
sh -x redis-install-6.2.13.sh启动状态查看:
systemctl status redis配置文件:/data/soft/redis/redis.conf
#如果需要修改密码:
requirepass yourpassword常用命令:
# 启动
systemctl start redis
# 关闭
systemctl stop redis
# 重启
systemctl restart redis
# 设置开机启动
systemctl enable redis
# 启动状态查看
systemctl status redis当Redis数据量过大时启动会报错:
# systemctl status redis
Process: 139622 ExecStop=/bin/kill -s QUIT (code=exited, status=1/FAILURE)修改文件:/usr/lib/systemd/system/redis.service
在配置文件中[Service]下增加一行:
ExecStartPost=/bin/sleep 0.1如果不行,在ExecStop行最后加上 $MAINPID:
[Unit]
Description=Redis
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/home/cjxx/soft/redis/redis.pid
ExecStart=/home/cjxx/soft/redis/bin/redis-server /home/cjxx/soft/redis/redis.conf
ExecReload=/home/cjxx/soft/redis/bin/redis-server -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target安装Zookeeper
cd /data/scripts
chmod +x zookeeper-install-3.7.0.sh
sh -x zookeeper-install-3.7.0.sh配置文件:/home/cjxx/soft/zookeeper/conf/zoo.cfg
修改zoo.cfg,关闭管理端口:
# 解决zookeeper启动占用8080端口方法
admin.serverPort=8011
# 可以更极端的配置,关闭管理配置
admin.enableServer=false常用命令:
# 设置开机启动
systemctl enable zookeeper
# 启动
systemctl start zookeeper
# 关闭
systemctl stop zookeeper
# 状态查看
systemctl status zookeeper
# 重启
systemctl restart zookeeper安装Nginx
cd /data/scripts
chmod +x nginx-install-1.24.0.sh
sh -x nginx-install-1.24.0.sh配置文件:/data/soft/nginx/conf/nginx.conf
系统漏洞修复,在keepalive_timeout后加一行:
keepalive_requests 1000版本1.27.1,需要加上配置,默认有问题:
proxy_buffering off
# 设置最大上传文件大小为 10 MB
client_max_body_size 300M
client_body_buffer_size 300M常用命令:
# 当前版本
/home/cjxx/soft/nginx/sbin/nginx -V
# 启动
systemctl start nginx
# 关闭
systemctl stop nginx
# 开机启动
systemctl enable nginx
# 判断是否开机启动
systemctl is-enabled nginx
# nginx启动关闭状态判断
systemctl status nginx
# 修改nginx配置文件后重新装载配置文件
systemctl reload nginx
# 重启
systemctl restart nginx
systemctl reload nginx; systemctl restart nginx安装STEC-DevOps
cd /data/scripts
chmod +x stec-devops-install.sh
sh -x stec-devops-install.sh会安装到/data/server/stec-devops
发布的jar包目录默认在(可以自己配置发布地址):
/data/apps_jar
/data/apps_view (前端页面)常用命令:
# 设置为开机启动
chkconfig stec-devops on
# 启动
service stec-devops start
# 运行状态查看
service stec-devops status
# 关闭
service stec-devops stop
service stec-devops stop; service stec-devops start安装MySQL数据库
(需要修改mysql-install-5.7.44.sh中new_password中的密码配置,以满足复杂度要求)
cd /data/scripts
chmod +x mysql-install-5.7.44.sh
sh -x mysql-install-5.7.44.sh配置文件:/etc/my.cnf
# 配置log文件大小和保存时间
max_binlog_size=500M
expire_logs_days=15
ssl=0
binlog_format = ROW常用命令:
# 启动
systemctl start mysqld
# 关闭
systemctl stop mysqld
# 重启
systemctl restart mysqld
# 启动状态
systemctl status mysqld
# 设置开机启动
systemctl enable mysqld
mysql -V在CentOS中卸载MySQL应用---慎用:
sudo yum remove mysql-server安装Kafka
cd /data/scripts
chmod +x kafka-install.sh
sh -x kafka-install.sh安装后IP地址可能需要改,需要检查/data/soft/kafka/config/server.properties:
adversised.listeners=PLAINTEXT://newipaddress:9092常用命令:
# 设置开机启动
systemctl enable kafka
# 启动
systemctl start kafka
# 关闭
systemctl stop kafka
# 状态查看
systemctl status kafka
systemctl restart kafka安装RabbitMQ
启动:
systemctl start rabbitmq-server查看RabbitMQ状态:
rabbitmqctl status示例输出:
Connection count: 1
Queue count: 8
Virtual host count: 3安装InfluxDB-1.6.0
cd /data/scripts
chmod +x influxdb-1.6.0-install.sh
sh -x influxdb-1.6.0-install.sh备份:
sh -x influxdb-backup.sh修改备份地址:
influxdb_backup_dir=/home/data/backup/influxdb还原:
sh -x influxdb-restore.sh
tar -xzvf influxdb_backup_2023_03_07.tar.gz
# 解压备份文件---解压后的目录有问题,这里需要注意
# 全库还原,目录为解压出来的备份数据目录--目录有问题
influxd restore -portable /data/backup/influxdb/home/data/backup/influxdb/temp常用命令:
systemctl start influxdb
systemctl stop influxdb
# 设置开机启动
systemctl enable influxdb
systemctl status influxdb安装FastDFS-5.12
cd /data/scripts
chmod +x fastdfs-install-V6.07.sh
sh -x fastdfs-install-V6.07.sh常用命令:
# storage启动
service fdfs_storaged start
# storage关闭
service fdfs_storaged stop
# 设置storage开机启动
chkconfig fdfs_trackerd on
# storage重启
service fdfs_storaged restart
# tracker启动
service fdfs_trackerd start
# tracker关闭
service fdfs_trackerd stop
# tracker重启
service fdfs_trackerd restart
# 设置tracker开机启动
chkconfig fdfs_trackerd on
# 查看状态
service fdfs_trackerd status
service fdfs_storaged status安装FineReport
cd /data/scripts
chmod +x finereport-install.sh
sh -x finereport-install.sh安装LibreOffice
cd /data/scripts
chmod +x libreoffice-install.sh
sh -x libreoffice-install.shIP地址现在的是安装环境,正式环境时,需要改IP。
安装Nacos
**说明:**安装Nacos前,需要先安装JDK。
安装:
cd /data/scripts
chmod +x nacos-install.sh
sh -x nacos-install.sh常用命令:
systemctl start nacos
systemctl status nacos
systemctl stop nacos
systemctl start nacos
# 设置开机启动
systemctl enable nacos