项目:wgcloud监控
项目目的:wgcloud监控搭建一套监控系统,
实验过程:利用wgstart监控工具,搭建一套监控系统,主要有两台服务器,一台是群辉虚拟机,centos764为系统,客户端两个,一个是群辉虚拟机,当主机也当客户端,另一个是debian11 32位的小主机
实验前置环境:server所在主机需要JDK1.8环境(JDK11也可以),OpenJDK1.8
项目开始:

安装JAVA环境
 yum install java-1.8.0-openjdk.x86_64
验证
# java -version
openjdk version "1.8.0_342"
OpenJDK Runtime Environment (build 1.8.0_342-b07)
OpenJDK 64-Bit Server VM (build 25.342-b07, mixed mode)
 
[root@localhost ~]# cd /usr/lib/jvm
[root@localhost jvm]# ll
total 0
drwxr-xr-x. 3 root root 17 Aug 17 15:24 java-1.8.0-openjdk-1.8.0.342.b07-1.el7_9.x86_64
lrwxrwxrwx. 1 root root 21 Aug 17 15:24 jre -> /etc/alternatives/jre
lrwxrwxrwx. 1 root root 27 Aug 17 15:24 jre-1.8.0 -> /etc/alternatives/jre_1.8.0
lrwxrwxrwx. 1 root root 35 Aug 17 15:24 jre-1.8.0-openjdk -> /etc/alternatives/jre_1.8.0_openjdk
lrwxrwxrwx. 1 root root 51 Aug 17 15:24 jre-1.8.0-openjdk-1.8.0.342.b07-1.el7_9.x86_64 -> java-1.8.0-openjdk-1.8.0.342.b07-1.el7_9.x86_64/jre
lrwxrwxrwx. 1 root root 29 Aug 17 15:24 jre-openjdk -> /etc/alternatives/jre_openjdk
 
[root@localhost jvm]# ls
java-1.8.0-openjdk-1.8.0.342.b07-1.el7_9.x86_64
jre
jre-1.8.0
jre-1.8.0-openjdk
jre-1.8.0-openjdk-1.8.0.342.b07-1.el7_9.x86_64
 
安装mysql 
[root@localhost shitou]# ls
mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz  wgcloud-v3.3.9.tar.gz
wgcloud-v3.3.9
[root@localhost shitou]# tar -xvf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz
mysql-5.7.24-linux-glibc2.12-x86_64/bin/myisam_ftdump
mysql-5.7.24-linux-glibc2.12-x86_64/bin/myisamchk
#将文件移动到/usr/local/mysql 并重命名
[root@localhost shitou]# mv mysql-5.7.24-linux-glibc2.12-x86_64 /usr/local/mysql
 
[root@localhost shitou]# ls /
bin   dev  home  lib64  mnt  proc  run   srv  tmp  var
boot  etc  lib   media  opt  root  sbin  sys  usr
[root@localhost shitou]# mkdir /data/
[root@localhost shitou]# ls
mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz  wgcloud-v3.3.9.tar.gz
wgcloud-v3.3.9
[root@localhost shitou]# mkdir /data/mysql
[root@localhost shitou]# ls /
bin   data  etc   lib    media  opt   root  sbin  sys  usr
boot  dev   home  lib64  mnt    proc  run   srv   tmp  var
[root@localhost shitou]# ls /data/
mysql
[root@localhost shitou]# grouopadd mysql创建数据库用户
-bash: grouopadd: 未找到命令
[root@localhost shitou]# groupadd mysql
[root@localhost shitou]# useradd -r -s /sbin/nologin -g mysql mysql -d /usr/local/mysql
[root@localhost shitou]# cd /usr/local/mysql/
[root@localhost mysql]#
改变目录所有者
[root@localhost mysql]# chown -R mysql *
[root@localhost mysql]# chgrp -R mysql *
 
[root@localhost mysql]# chown -R mysql /data/mysql
 
配置参数
[root@localhost mysql]# bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql
2022-08-17T10:10:04.509465Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-08-17T10:10:07.572674Z 0 [Warning] InnoDB: New log files created, LSN=45790
2022-08-17T10:10:08.437799Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2022-08-17T10:10:08.822977Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: c5fd1112-1e14-11ed-8bae-0211322f8633.
2022-08-17T10:10:08.944283Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2022-08-17T10:10:08.949209Z 1 [Note] A temporary password is generated for root@localhost: mYQ3wSwqb)Yf
 
继续
[root@localhost mysql]# bin/mysql_ssl_rsa_setup --datadir=/data/mysql
Generating a 2048 bit RSA private key
.....................+++
....................................................+++
writing new private key to 'ca-key.pem'
-----
Generating a 2048 bit RSA private key
...........................................................................................................................................+++
.................................+++
writing new private key to 'server-key.pem'
-----
Generating a 2048 bit RSA private key
...........................................+++
..............+++
writing new private key to 'client-key.pem'
-----
修改系统配置文件    
[root@localhost mysql]# cd /usr/local/mysql/support-files
[root@localhost support-files]# cp mysql.server /etc/init.d/mysql
修改一下内容
# vi /etc/init.d/mysql 
basedir=/usr/local/mysql
datadir=/data/mysql
注:mysql5.7.21不需要my.cnf文件,所以需要检查/etc目录下是否存在my.cnf文件,若存在需删除,否则启动服务会报错
[root@localhost support-files]# ls /etc/my.cnf
/etc/my.cnf
[root@localhost support-files]# mv /etc/my.cnf /home/shitou/my.conf
[root@localhost support-files]# ls /etc/my.cnf
ls: cannot access /etc/my.cnf: No such file or directory
启动mysql
root@localhost support-files]# service mysql start
Starting MySQL.Logging to '/data/mysql/localhost.localdomain.err'.
. SUCCESS!
 
[root@localhost support-files]# mysql -hlocalhost -uroot -p
-bash: mysql: 未找到命令
执行下面的命令
[root@localhost support-files]#  ln -s /usr/local/mysql/bin/mysql /usr/bin  
 
 
[root@localhost support-files]# mysql -hlocalhost -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.24
 
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
 
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
 
mysql>  set password=password('hcgxg521');
Query OK, 0 rows affected, 1 warning (0.00 sec)
 
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'hcgxg521';
Query OK, 0 rows affected, 1 warning (0.00 sec)
 
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
 
#输入use mysql;查看表
 
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
#输入select host,user from user; 显示下面就可以远程连接了
mysql> select host,user from user;
+-----------+---------------+
| host      | user          |
+-----------+---------------+
| %         | root          |
| localhost | mysql.session |
| localhost | mysql.sys     |
| localhost | root          |
+-----------+---------------+
4 rows in set (0.01 sec)
 
 
开启端口3306 
firewall-cmd --zone=public --add-port=3306/tcp --permanent
 firewall-cmd --reload重启防火墙
 
 vim /etc/profile
 
export PATH=/usr/local/mysql/bin:$PATH
设置mysql自启动
[root@localhost support-files]# chmod 755 /etc/init.d/mysql
[root@localhost support-files]# chkconfig --add mysql
[root@localhost support-files]# chkconfig --level 345 mysql on
[root@localhost support-files]#source /wgcloudTest/wgcloud-MySQL_v3.3.9.sql;