挂盘与依赖添加
#挂盘语句
fdisk /dev/vdb 在分别输入n、p、1、2048、1048575999、w
mkfs.ext4 /dev/vdb
mkdir /data
echo “/dev/vdb /data ext4 defaults 0 0” >> /etc/fstab
mount -a
df -h
#添加C++依赖
yum -y install gcc automake make
yum install pcre
yum -y install pam-devel openldap-devel cyrus-sasl-devel openssl-devel
yum install pcre-devel zlib zlib-devel openssl openssl-devel
nginx安装编译
#nginx安装语句
./configure --with-stream --with-stream=dynamic --with-http_ssl_module
make
make install
vim /etc/init.d/nginx [内容在下面]
chmod 755 /etc/init.d/nginx
chkconfig nginx on
init.d/nginx
#!/bin/sh
#
#nginx - this script starts and stops the nginx daemin
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/logs/nginx.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
nginx="/usr/local/nginx/sbin/nginx"
prog=$(basename $nginx)
NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"
lockfile=/var/lock/subsys/nginx
start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
configtest || return $?
stop
start
}
reload() {
configtest || return $?
echo -n $"Reloading $prog: "
killproc $nginx -HUP
RETVAL=$?
echo
}
force_reload() {
restart
}
configtest() {
$nginx -t -c $NGINX_CONF_FILE
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit 2
esac
iptable内网通过前置机访问外网操作
https://support.huaweicloud.com/usermanual-ecs/ecs_03_0705.html 【内网服务器通过公网ip服务器访问外网】
#修改内核参数,开启转发功能
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf && sysctl -p
cat /proc/sys/net/ipv4/ip_forward
#配置iptables
iptables -t nat -I POSTROUTING -s 192.168.0.179 -j SNAT --to-source 192.168.0.226
#查看是否添加成功
iptables -L -n -t nat
#重启后依旧生效
sudo chmod a+w -R /opt
sudo iptables-save > /opt/iptables.rules
sudo iptables-restore < /opt/iptables.rules
docker相关
#启动gitlab
docker run --detach --memory 6500M --publish 8443:443 --publish 8090:8090 --publish 8222:22 --name gitlab --restart always --volume /data/docker-data/gitlab/config:/etc/gitlab --volume /data/docker-data/gitlab/logs:/var/log/gitlab --volume /data/docker-data/gitlab/data:/var/opt/gitlab yrzr/gitlab-ce-arm64v8:latest
#启动mysql
#docker run --name mysql -p 13306:3306 --privileged=true -v /data/docker-data/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=ems$1839 -d biarms/mysql
docker run -p 13306:3306 --name mysql -v /data/docker-data/mysql/conf:/etc/mysql -v /data/docker-data/mysql/data:/var/lib/mysql -v /data/mysql/my.cnf:/etc/mysql/my.cnf -e MYSQL_ROOT_PASSWORD=553260cfq$ -d biarms/mysql
#启动redis
docker run --restart=always --log-opt max-size=100m --log-opt max-file=2 -p 16379:6379 --name myredis -v /data/docker-data/redis/myredis/myredis.conf:/etc/redis/redis.conf -v /data/docker-data/redis/myredis/data:/data -d redis redis-server /etc/redis/redis.conf --appendonly yes --requirepass ecan@redis
#启动zookeeper
docker run -d -e TZ="Asia/Shanghai" -p 12181:2181 -v /data/docker-data/zookeeper:/data --name zookeeper --restart always zookeeper
#docker语句
docker ps -a
docker rm 4d5e
docker stop 4d5e
docker exec -it gitlab /bin/bash
vi /var/opt/gitlab/redis/redis.conf
去掉# ignore-warnings ARM64-COW-BUG 注释
gitlab-rails console -e production
user = User.where(id: 1).first
user.password='pwd22.'
# 2.首先查询gitlab的各个服务的状态,是否是run
gitlab-ctl status
# 若有down,那么就尝试启动一下
gitlab-ctl start xxxx
# 如果起不来,建议查下日志
gitlab-ctl tail -f xxxx
#手动上传项目
git remote remove origin
git remote add origin http://124.26.42.250:8199/EXX.git
git push -u origin --all
#拉取所有远程分支
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
#初始化项目
mvn idea:idea install
查看nginx并发
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
netstat -pnt | grep :80 | wc -l
#查看
netstat -apn|grep 'nginx: worker' | wc -l
1、根据访问IP统计UV
awk '{print $1}' access.log|sort | uniq -c |wc -l
2.统计访问URL统计PV
awk '{print $7}' access.log|wc -l
3.查询访问最频繁的URL
awk '{print $7}' access.log|sort | uniq -c |sort -n -k 1 -r|more
4.查询访问最频繁的IP
awk '{print $1}' access.log|sort | uniq -c |sort -n -k 1 -r|more
5.根据时间段统计查看日志
cat access.log| sed -n '/14\/Mar\/2015:21/,/14\/Mar\/2015:22/p'|more
6.查看nginx的并发量
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'