stream {
log_format proxy 'time_local] '
'status bytes_received '
'upstream_addr" '
'"upstream_bytes_received" "$upstream_connect_time"';
access_log /apps/nginx/logs/tcp-access.log proxy;
open_log_file_cache off;
upstream ssh_server {
server 192.168.3.101:2222;
}
server {
listen 2222;
proxy_pass ssh_server;
proxy_protocol on;
proxy_connect_timeout 30s;
}
upstream xrdp_server {
server 192.168.3.101:3389;
}
server {
listen 3389;
proxy_pass xrdp_server;
#proxy_protocol on;
proxy_connect_timeout 30s;
}
}
location / {
proxy_pass http://http_server;
proxy_buffering off;
proxy_request_buffering off;
proxy_http_version 1.1;
proxy_set_header Host proxy_add_x_forwarded_for;
proxy_set_header Upgrade http_connection;
proxy_ignore_client_abort on;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 6000;
}
}
https://www.cnblogs.com/feifa/p/16935176.html
!/bin/bash
echo "安装依赖包......"
yum -y install gcc automake autoconf libtool make wget jemalloc-devel systemd-devel
echo "Redis-6.2.4.tar.gz安装包下载......"
wget "https://download.redis.io/releases/redis-6.2.4.tar.gz"
echo "安装包解压......"
tar -xzvf redis-6.2.4.tar.gz
echo "初始化及安装redis......"
cd redis-6.2.4
make USE_SYSTEMD=yes PREFIX=/apps/redis install
echo "配置环境变量......"
echo 'PATH=/apps/redis/bin:$PATH' > /etc/profile.d/redis.sh
source /etc/profile.d/redis.sh
sleep 1
echo "Redis目录创建......"
mkdir -p /apps/redis/{etc,log,data,run}
echo "Redis启动优化......"
cat >> /etc/sysctl.conf << EOF
net.core.somaxconn = 1024
vm.overcommit_memory = 1
EOF
sysctl -p
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
echo "创建Redis程序用户......"
useradd -r -s /sbin/nologin redis
echo "准备Redis配置文件......"
cat > /apps/redis/etc/redis.conf << EOF
daemonize yes
bind 0.0.0.0
port 6379
pidfile /apps/redis/run/redis.pid
logfile /apps/redis/log/redis.log
requirepass "P@sswOrd"
masterauth "P@sswOrd"
databases 16
dbfilename dump.rdb
dir /apps/redis/data
maxclients 500
EOF
echo "设置目录权限......"
chown -R redis.redis /apps/redis/
echo "配置systemd启动脚本......"
cat > /usr/lib/systemd/system/redis.service << EOF
[Unit]
Description=Redis persistent key-value database
After=network.target
[Service]
ExecStart=/apps/redis/bin/redis-server /apps/redis/etc/redis.conf --supervised systemd
ExecStop=/apps/redis/bin/redis-cli shutdown save
Type=notify
User=redis
Group=redis
RuntimeDirectory=redis
RuntimeDirectoryMode=0755
[Install]
WantedBy=multi-user.target
EOF
echo "检测脚本启动redis......"
systemctl daemon-reload
systemctl enable redis && systemctl start redis && systemctl status redis
1、配置YUM源
下载MySQL源安装包
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
安装MySQL源
yum -y localinstall mysql57-community-release-el7-8.noarch.rpm
yum install mysql-community-server -y
systemctl start mysqld
从日志里取密码
grep "password" /var/log/mysqld.log
create user 'root'@'%' identified by 'P@sswOrd';
GRANT ALL ON . TO 'root'@'%';
########新安装的数据库登录上去修改密码
mysql> alter user 'root'@'localhost' identified by 'P@sswOrd';
########查看库的用户
mysql> SELECT User, Host FROM mysql.user;
mysql> alter user 'root'@'localhost' identified by 'P@sswOrd';
Query OK, 0 rows affected (0.00 sec)
mysql> create user 'root'@'%' identified by 'P@sswOrd';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL ON . TO 'root'@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT User, Host FROM mysql.user;
+---------------+-----------+
| User | Host |
+---------------+-----------+
| root | % |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+---------------+-----------+
4 rows in set (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
[root@jumpserver-02 ~]# vim /etc/my.cnf
[root@jumpserver-02 ~]# mkdir /var/log/mysql
[root@jumpserver-02 ~]# chown mysql.mysql /var/log/mysql
[root@jumpserver-02 ~]# systemctl restart mysqld
[root@jumpserver-02 ~]# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log_bin=/var/log/mysql/mysql-bin
server-id=2
auto_increment_offset=2
auto_increment_increment=2
validate_password=off #关密码强度(由于提供的密码不符合>之前的密码策略)
Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
mysql> GRANT ALL ON . TO 'root'@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT User, Host FROM mysql.user;
mysql> create database jumpserver charset utf8mb4;
Query OK, 1 row affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
导入数据
source /root/cacti.sql
查看表
show tables;
解决1054问题
vim /etc/my.cnf
加入下面参数
skip_grant_tables
进入数据库修改
如下
use mysql;
update mysql.user set authentication_string=password('123456') where user='root' ;
flush privileges;
systemctl restart mysqld
查看建库语句
show create database jumpserver;
进去改密
mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
mysql> flush privileges;
change master to
master_host='10.66.70.120',
master_port=3307,
master_user='root',
master_password='P@sswOrd',
master_log_file='mysql-bin.000008',
master_log_pos=154;
show slave status\G;
stop slave
reset slave all
change master to
start slave
show master status;
show master status\G;