wukaiqiang 发布的文章

[oracle@test ~]$ export ORACLE_PDB_SID=ORCLPDB1
[oracle@test ~]$ expdp \"/ as sysdba\" tables=hr.employees

Export: Release 19.0.0.0.0 - Production on Wed Dec 16 02:37:37 2020
Version 19.9.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Starting "SYS"."SYS_EXPORT_TABLE_01": "/ AS SYSDBA" tables=hr.employees
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS

PMM的简介及安装

一、简介

PERCONA MYSQL ,到底谁是受益者 - 云+社区 - 腾讯云 (tencent.com)

Percona Monitoring and Management (PMM)是一款开源的专用于管理和监控MySQL、MongoDB、PostgreSQL、ProxySQL、AWS RDS性能的开源平台,并且可以监控前述这些数据库所在的服务器资源,通过PMM客户端收集到的DB监控数据用第三方软件Grafana画图展示出来。

二、部署

uname -r

安装pmm2 要求内核版本大于3.10

2.1 docker安装

yum list all | grep docker
yum install docker

启动docker

systemctl start docker
systemctl enable docker

下载pmm2

docker pull percona/pmm-server:2

创建持久化包

docker create --volume /srv --name pmm-data percona/pmm-server:2 /bin/true

创建服务端

docker run -d -p 81:80 -p 9090:9090 -p 9094:9094 -p 9001:9001 -p 3000:3000 -p 8500:8500 -p 8600:8600 -p 443:443 -p 8880:8880 -p 9093:9093 -p 9911:9911 -p 9922:9922 -p 20201:20201 -p 20203:20203 --volumes-from pmm-data --name pmm-server -e METRICS_RETENTION=8760h -e METRICS_MEMORY=351881216 -e METRICS_RESOLUTION=3s -e DISABLE_TELEMETRY=true -e GF_AUTH_PROXY_ENABLED=true -e GF_AUTH_ANONYMOUS_ENABLED=true --restart always percona/pmm-server:2

查看安装情况

docker ps -a

启动服务

docker start pmm-server

下载客户端

docker pull percona/pmm-client:latest

运行客户端

PMM_SERVER=127.0.0.1:444
docker run --rm --name pmm-client -e PMM_AGENT_SERVER_ADDRESS=${PMM_SERVER} -e PMM_AGENT_SERVER_USERNAME=admin -e PMM_AGENT_SERVER_PASSWORD=admin -e PMM_AGENT_SERVER_INSECURE_TLS=1 -e PMM_AGENT_SETUP=1 -e PMM_AGENT_CONFIG_FILE=pmm-agent.yml --volumes-from pmm-client-data percona/pmm-client:latest

访问服务端

http://www.wukaiqiang.top:81/

默认账号admin密码admin
docker exec -it c4510784041c /bin/bash
bash-4.2$ pmm-admin add mysql --username=root --password=root --host 172.17.0.13 --port 3306

微信截图_20211027231929.png

cat /root/batchping.py

#!/usr/bin/python3

# -*- coding: utf-8 -*-

import time, subprocess, threading

#from queue import Quese

time_start = time.time()

iplist = open('/root/aixiplist.txt','r')

errorlist = []



def checkalive(ip):

  status = subprocess.call('ping -c 2 %s' % ip, shell=True,stdout=subprocess.PIPE)

  if status == 0:

    pass

  elif status == 1:

    print('无法连接'+ ip)

    errorlist.append(ip)



#thread

if __name__ == '__main__':

  print('---------------------')

  lt = time.asctime(time.localtime(time.time()))

  print('当前时间',lt)

  threads = []

  for ip in iplist:

    t = threading.Thread(target=checkalive,args=(ip,))

    t.start()

    threads.append(t)     

  for t in threads:

    t.join()

  if len(errorlist) >= 1:

    print(errorlist,'down')

  if len(errorlist) == 0:

    print('all pong')

  time_end = time.time()

  print('检测完毕,耗时',round(time_end - time_start,2),'秒')