标签:修改ip lvm -o 状态 cpu mysql etc gis pre
配置阿里云Docker Yum源 [root@xingdian ~]# yum install -y yum-utils device-mapper-persistent-data lvm2 git [root@xingdian ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo 安装Docker新版本(比如Docker 2010.2): [root@xingdian ~]# yum install docker-ce-20.10.2.ce -y 或者 [root@xingdian ~]# yum install docker-ce -y 启动Docker服务 [root@xingdian ~]# systemctl enable docker [root@xingdian ~]# systemctl start docker 查看docker版本状态 [root@xingdian ~]# docker -v Docker version 19.03.12, build 48a66213fe 查看docker运行状态: [root@xingdian ~]# docker info Client: Debug Mode: false Server: Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 3 Server Version: 19.03.12 Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Native Overlay Diff: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd init version: fec3683 Security Options: seccomp Profile: default Kernel Version: 3.10.0-1062.12.1.el7.x86_64 Operating System: CentOS Linux 7 (Core) OSType: linux Architecture: x86_64 CPUs: 4 Total Memory: 7.637GiB Name: xingdian ID:DW7V:VN63:7P5F:X36D:UPXA:WSXK:NVXU:FG4E:UIKY:ISIZ:AVW3:3RXT Docker Root Dir: /var/lib/docker Debug Mode: false Registry: https://index.docker.io/v1/ Labels: Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false 方法 2:配置镜像加速器 [root@xuegod63 ~]# tee /etc/docker/daemon.json << ‘EOF‘ { "registry-mirrors":["https://rsbud4vc.mirror.aliyuncs.com" } EOF 重启 docker 服务使配置生效 [root@xuegod63 ~]# systemctl daemon-reload && systemctl restart docker
prometheus安装
docker pull prom/node-exporter docker pull prom/prometheus docker pull grafana/grafana
docker run -d -p 9100:9100 -v "/proc:/host/proc:ro" -v "/sys:/host/sys:ro" -v "/:/rootfs:ro" --net="host" prom/node-exporter
root@ubuntu:~# netstat -anpt Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1147/sshd tcp 0 36 192.168.91.132:22 192.168.91.1:63648 ESTABLISHED 2969/0 tcp 0 0 192.168.91.132:22 192.168.91.1:63340 ESTABLISHED 1321/1 tcp6 0 0 :::9100 :::* LISTEN 3070/node_exporter
http://192.168.91.132:9100/metrics
mkdir /opt/prometheus cd /opt/prometheus/ vim prometheus.yml
global: scrape_interval: 60s evaluation_interval: 60s scrape_configs: - job_name: prometheus static_configs: - targets: [‘localhost:9090‘] labels: instance: prometheus - job_name: linux static_configs: - targets: [‘192.168.91.132:9100‘] labels: instance: localhost
docker run -d -p 9090:9090 -v /opt/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
root@ubuntu:/opt/prometheus# netstat -anpt Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1147/sshd tcp 0 36 192.168.91.132:22 192.168.91.1:63648 ESTABLISHED 2969/0 tcp 0 0 192.168.91.132:22 192.168.91.1:63340 ESTABLISHED 1321/1 tcp6 0 0 :::9100 :::* LISTEN 3070/node_exporter tcp6 0 0 :::22 :::* LISTEN 1147/sshd tcp6 0 0 :::9090 :::* LISTEN 3336/docker-proxy
mkdir /opt/grafana-storage
chmod 777 -R /opt/grafana-storage
docker run -d -p 3000:3000 --name=grafana -v /opt/grafana-storage:/var/lib/grafana grafana/grafana
root@ubuntu:/opt/prometheus# netstat -anpt Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1147/sshd tcp 0 36 192.168.91.132:22 192.168.91.1:63648 ESTABLISHED 2969/0 tcp 0 0 192.168.91.132:22 192.168.91.1:63340 ESTABLISHED 1321/1 tcp6 0 0 :::9100 :::* LISTEN 3070/node_exporter tcp6 0 0 :::22 :::* LISTEN 1147/sshd tcp6 0 0 :::3000 :::* LISTEN 3494/docker-proxy tcp6 0 0 :::9090 :::* LISTEN 3336/docker-proxy tcp6 0 0 192.168.91.132:9100 172.17.0.2:55108 ESTABLISHED 3070/node_exporter
mysql的官方网站:www.mysql.com mysql最新版本:8.0 mysql使用最多:5.7 默认情况下:centos的仓库里没有mysql,去官网下载mysql仓库安装包 1.下载mysql的yum仓库 [root@22e34e653991 /]# wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm 2.安装mysql的yum仓库 [root@22e34e653991 /]# rpm -ivh mysql80-community-release-el7-3.noarch.rpm 3.修改安装版本(方法一) [root@22e34e653991 /]# yum repolist all | grep mysql 查看所有关于mysql的库 [root@22e34e653991 /]# yum -y install yum-utils yum的工具包 [root@22e34e653991 /]# yum-config-manager --enable mysql57-community 启动mysql57 [root@22e34e653991 /]# yum-config-manager --disable mysql80-community 禁用mysql80 4.安装数据库 [root@22e34e653991 /]# yum -y install mysql mysql-server 修改yum仓库(方法二) systemctl start mysqld 5.查看数据库的初始密码 [root@22e34e653991 /]# grep ‘password‘ /var/log/mysqld.log 2019-07-13T15:14:31.176905Z 1 [Note] A temporary password is generated for root@localhost: k12zPB1r;2Ta 6.使用密码登陆 [root@22e34e653991 /]# mysql -u root -p‘k12zPB1r;2Ta‘ 7.修改密码 方法一: mysql> ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘Cj@123‘; 方法二: [root@22e34e653991 /]# mysqladmin -u root -p‘k12zPB1r;2Ta‘ password ‘cj@123‘ 密码:大小写有特殊字符数字
CREATE USER ‘exporter‘@‘localhost‘ IDENTIFIED BY ‘XXXXXXXX‘ WITH MAX_USER_CONNECTIONS 3;
GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO ‘exporter‘@‘localhost‘;
cd mysqld_exporter-0.10.0.linux-amd64 cat my.cnf [client] user=exporter password=Abcdef123!. host=127.0.0.1
host一定要写
nohup ./mysqld_exporter --config.my-cnf=./my.cnf &
vim /opt/prometheus/prometheus.yml - job_name: ‘mysql‘ static_configs: - targets: [‘192.168.40.180:9104‘]
root@ubuntu:/opt/prometheus# docker ps |grep prometheus 0fa256f85750 prom/prometheus "/bin/prometheus --c…" About an hour ago Up 29 seconds 0.0.0.0:9090->9090/tcp wizardly_kirch root@ubuntu:/opt/prometheus# docker restart 0fa256f85750
标签:修改ip lvm -o 状态 cpu mysql etc gis pre
原文地址:https://www.cnblogs.com/xiaoai666/p/14923202.html