> 原文链接[Zabbix分区表](https://www.zabbix.org/wiki/Docs/howto/mysql_partition "Zabbix分区表")
> #### TokuDB可以大大缓解插入性能的瓶颈,并且存储空间大大减少,结合分区表效果更佳
#### Zabbix大表有哪些
| 表名 |大小 |
| :------------: | :------------: |
| history | |
| history_log | |
| history_str | |
| history_text ||
| history_uint | |
| trends | |
| trends_uint | ||
#### 分表前提
- 按时间范围分表(字段clock,字段无索引)
- MySQL分区表要求范围字段是唯一索引或主键索引,或者是其中一部分,需要修改前核实clock是否在索引中
#### 创建4个存储过程
存储过程1
```shell
DELIMITER $$
CREATE PROCEDURE `partition_create`(SCHEMANAME varchar(64), TABLENAME varchar(64), PARTITIONNAME varchar(64), CLOCK int)
BEGIN
/*
SCHEMANAME = The DB schema in which to make changes
TABLENAME = The table with partitions to potentially delete
PARTITIONNAME = The name of the partition to create
*/
/*
Verify that the partition does not already exist
*/
DECLARE RETROWS INT;
SELECT COUNT(1) INTO RETROWS
FROM information_schema.partitions
WHERE table_schema = SCHEMANAME AND table_name = TABLENAME AND partition_description >= CLOCK;
IF RETROWS = 0 THEN
/*
1. Print a message indicating that a partition was created.
2. Create the SQL to create the partition.
3. Execute the SQL from #2.
*/
SELECT CONCAT( "partition_create(", SCHEMANAME, ",", TABLENAME, ",", PARTITIONNAME, ",", CLOCK, ")" ) AS msg;
SET @sql = CONCAT( 'ALTER TABLE ', SCHEMANAME, '.', TABLENAME, ' ADD PARTITION (PARTITION ', PARTITIONNAME, ' VALUES LESS THAN (', CLOCK, '));' );
PREPARE STMT FROM @sql;
EXECUTE STMT;
DEALLOCATE PREPARE STMT;
END IF;
END$$
DELIMITER ;
```
存储过程2
```
DELIMITER $$
CREATE PROCEDURE `partition_drop`(SCHEMANAME VARCHAR(64), TABLENAME VARCHAR(64), DELETE_BELOW_PARTITION_DATE BIGINT)
BEGIN
/*
SCHEMANAME = The DB schema in which to make changes
TABLENAME = The table with partitions to potentially delete
DELETE_BELOW_PARTITION_DATE = Delete any partitions with names that are dates older than this one (yyyy-mm-dd)
*/
DECLARE done INT DEFAULT FALSE;
DECLARE drop_part_name VARCHAR(16);
/*
Get a list of all the partitions that are older than the date
in DELETE_BELOW_PARTITION_DATE. All partitions are prefixed with
a "p", so use SUBSTRING TO get rid of that character.
*/
DECLARE myCursor CURSOR FOR
SELECT partition_name
FROM information_schema.partitions
WHERE table_schema = SCHEMANAME AND table_name = TABLENAME AND CAST(SUBSTRING(partition_name FROM 2) AS UNSIGNED) < DELETE_BELOW_PARTITION_DATE;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
/*
Create the basics for when we need to drop the partition. Also, create
@drop_partitions to hold a comma-delimited list of all partitions that
should be deleted.
*/
SET @alter_header = CONCAT("ALTER TABLE ", SCHEMANAME, ".", TABLENAME, " DROP PARTITION ");
SET @drop_partitions = "";
/*
Start looping through all the partitions that are too old.
*/
OPEN myCursor;
read_loop: LOOP
FETCH myCursor INTO drop_part_name;
IF done THEN
LEAVE read_loop;
END IF;
SET @drop_partitions = IF(@drop_partitions = "", drop_part_name, CONCAT(@drop_partitions, ",", drop_part_name));
END LOOP;
IF @drop_partitions != "" THEN
/*
1. Build the SQL to drop all the necessary partitions.
2. Run the SQL to drop the partitions.
3. Print out the table partitions that were deleted.
*/
SET @full_sql = CONCAT(@alter_header, @drop_partitions, ";");
PREPARE STMT FROM @full_sql;
EXECUTE STMT;
DEALLOCATE PREPARE STMT;
SELECT CONCAT(SCHEMANAME, ".", TABLENAME) AS `table`, @drop_partitions AS `partitions_deleted`;
ELSE
/*
No partitions are being deleted, so print out "N/A" (Not applicable) to indicate
that no changes were made.
*/
SELECT CONCAT(SCHEMANAME, ".", TABLENAME) AS `table`, "N/A" AS `partitions_deleted`;
END IF;
END$$
DELIMITER ;
```
存储过程3
```
DELIMITER $$
CREATE PROCEDURE `partition_maintenance`(SCHEMA_NAME VARCHAR(32), TABLE_NAME VARCHAR(32), KEEP_DATA_DAYS INT, HOURLY_INTERVAL INT, CREATE_NEXT_INTERVALS INT)
BEGIN
DECLARE OLDER_THAN_PARTITION_DATE VARCHAR(16);
DECLARE PARTITION_NAME VARCHAR(16);
DECLARE OLD_PARTITION_NAME VARCHAR(16);
DECLARE LESS_THAN_TIMESTAMP INT;
DECLARE CUR_TIME INT;
CALL partition_verify(SCHEMA_NAME, TABLE_NAME, HOURLY_INTERVAL);
SET CUR_TIME = UNIX_TIMESTAMP(DATE_FORMAT(NOW(), '%Y-%m-%d 00:00:00'));
SET @__interval = 1;
create_loop: LOOP
IF @__interval > CREATE_NEXT_INTERVALS THEN
LEAVE create_loop;
END IF;
SET LESS_THAN_TIMESTAMP = CUR_TIME + (HOURLY_INTERVAL * @__interval * 3600);
SET PARTITION_NAME = FROM_UNIXTIME(CUR_TIME + HOURLY_INTERVAL * (@__interval - 1) * 3600, 'p%Y%m%d%H00');
IF(PARTITION_NAME != OLD_PARTITION_NAME) THEN
CALL partition_create(SCHEMA_NAME, TABLE_NAME, PARTITION_NAME, LESS_THAN_TIMESTAMP);
END IF;
SET @__interval=@__interval+1;
SET OLD_PARTITION_NAME = PARTITION_NAME;
END LOOP;
SET OLDER_THAN_PARTITION_DATE=DATE_FORMAT(DATE_SUB(NOW(), INTERVAL KEEP_DATA_DAYS DAY), '%Y%m%d0000');
CALL partition_drop(SCHEMA_NAME, TABLE_NAME, OLDER_THAN_PARTITION_DATE);
END$$
DELIMITER ;
```
存储过程4
```
DELIMITER $$
CREATE PROCEDURE `partition_verify`(SCHEMANAME VARCHAR(64), TABLENAME VARCHAR(64), HOURLYINTERVAL INT(11))
BEGIN
DECLARE PARTITION_NAME VARCHAR(16);
DECLARE RETROWS INT(11);
DECLARE FUTURE_TIMESTAMP TIMESTAMP;
/*
* Check if any partitions exist for the given SCHEMANAME.TABLENAME.
*/
SELECT COUNT(1) INTO RETROWS
FROM information_schema.partitions
WHERE table_schema = SCHEMANAME AND table_name = TABLENAME AND partition_name IS NULL;
/*
* If partitions do not exist, go ahead and partition the table
*/
IF RETROWS = 1 THEN
/*
* Take the current date at 00:00:00 and add HOURLYINTERVAL to it. This is the timestamp below which we will store values.
* We begin partitioning based on the beginning of a day. This is because we don't want to generate a random partition
* that won't necessarily fall in line with the desired partition naming (ie: if the hour interval is 24 hours, we could
* end up creating a partition now named "p201403270600" when all other partitions will be like "p201403280000").
*/
SET FUTURE_TIMESTAMP = TIMESTAMPADD(HOUR, HOURLYINTERVAL, CONCAT(CURDATE(), " ", '00:00:00'));
SET PARTITION_NAME = DATE_FORMAT(CURDATE(), 'p%Y%m%d%H00');
-- Create the partitioning query
SET @__PARTITION_SQL = CONCAT("ALTER TABLE ", SCHEMANAME, ".", TABLENAME, " PARTITION BY RANGE(`clock`)");
SET @__PARTITION_SQL = CONCAT(@__PARTITION_SQL, "(PARTITION ", PARTITION_NAME, " VALUES LESS THAN (", UNIX_TIMESTAMP(FUTURE_TIMESTAMP), "));");
-- Run the partitioning query
PREPARE STMT FROM @__PARTITION_SQL;
EXECUTE STMT;
DEALLOCATE PREPARE STMT;
END IF;
END$$
DELIMITER ;
```
#### 存储过程中有四个功能:
partition_create - 这将在给定模式中的给定表上创建一个分区。
partition_drop - 这将删除给定模式中给定表上给定时间戳的分区。
partition_maintenance - 此功能是用户调用的。它负责解析给定的参数,然后根据需要创建/删除分区。
partition_verify - 检查给定模式中给定表上是否启用了分区。如果没有启用,它将创建一个单独的分区。
##### partition_create
```shell
程序定义:partition_create(SCHEMANAME varchar(64),TABLENAME varchar(64),PARTITIONNAME varchar(64),CLOCK int)
示例:CALL partition_create(“zabbix”,“history”,“p20131216”,1387267200);
SCHEMANAME =要在其中进行更改的DB模式
TABLENAME =要在其上创建PARTITIONNAME的表
PARTITIONNAME =要创建的分区的名称
将创建CLOCK = PARTITIONNAME以保存“clock”列值小于此值的值
```
##### partition_drop
```shell
过程定义:partition_drop(SCHEMANAME VARCHAR(64),TABLENAME VARCHAR(64),DELETE_BELOW_PARTITION_DATE VARCHAR(64))
示例:CALL partition_drop(“zabbix”,“history”,“20131216”);
SCHEMANAME =要在其中进行更改的DB模式
TABLENAME =要删除PARTITIONNAME的表
DELETE_BELOW_PARTITION_DATE =允许的最旧分区日期。所有旧版本的分区将被删除。格式为yyyymmdd。
```
##### partition_maintenance
```shell
过程定义:partition_maintenance(SCHEMA_NAME VARCHAR(32),TABLE_NAME VARCHAR(32),KEEP_DATA_DAYS INT,HOURLY_INTERVAL INT,CREATE_NEXT_INTERVALS INT)
示例:CALL partition_maintenance('zabbix','history',28,24,14 );
SCHEMA_NAME =要在其中进行更改的DB模式
TABLE_NAME =要进行更改的表
KEEP_DATA_DAYS =要保留的分区的最大天数。所有超过此天数的分区将被删除。
HOURLY_INTERVAL =分区之间的小时间隔。例如,每日分区的值为24,小时分区的值为1。
CREATE_NEXT_INTERVALS =提前创建的值的分区数。
```
##### partition_verify
```shell
过程定义:partition_verify(SCHEMANAME VARCHAR(64),TABLENAME VARCHAR(64),HOURLYINTERVAL INT(11))
示例:CALL partition_verify(“zabbix”,“history”);
SCHEMANAME =要在其中进行更改的DB模式
TABLENAME =要检查分区的表
HOURLY_INTERVAL =分区之间的小时间隔。例如,每日分区的值为24,小时分区的值为1。
```
#### 分区表需求:
- 每月一个分区(24小时*31约等于720小时)
- 历史保存1年数据(12个月)
- 趋势保存2年数据(24个月)
- 未来周期12个(未来12个月)
单独语句:
```shell
CALL partition_maintenance('zabbix', 'history', 24, 720, 12);
CALL partition_maintenance(zabbix, 'trends', 48, 720, 12);
```
解释:创建24个分区,其中未来月份12个,每个周期存储720小时数据
#### 添加以下存储过程,用来增加新的分区和删除旧的分区
```shell
DELIMITER $$
CREATE PROCEDURE `partition_maintenance_all`(SCHEMA_NAME VARCHAR(32))
BEGIN
CALL partition_maintenance(SCHEMA_NAME, 'history', 24, 720, 12);
CALL partition_maintenance(SCHEMA_NAME, 'history_log', 24, 720, 12);
CALL partition_maintenance(SCHEMA_NAME, 'history_str', 24, 720, 12);
CALL partition_maintenance(SCHEMA_NAME, 'history_text', 24, 720, 12);
CALL partition_maintenance(SCHEMA_NAME, 'history_uint', 24, 720, 12);
CALL partition_maintenance(SCHEMA_NAME, 'trends', 48, 720, 12);
CALL partition_maintenance(SCHEMA_NAME, 'trends_uint', 48, 720, 12);
END$$
DELIMITER ;
```
##### 执行后,观察分区表状态是否建立
#### 定时调用此存储过程
用来增加新的分区和删除旧的分区,注意定时调用的间隔不能小于每次创建的未来的分区周期,如上情况,**最少12个月调用一次**
vim /root/shell/create_partition.sh 加入以下:
```shell
/opt/tokudb/mysql/bin/mysql -uzabbix -pzabbix zabbix -e "call partition_maintenance_all('zabbix');"
```
crontab -e 加入以下:
```shell
0 3 * */11 * sh /root/shell/create_partition.sh
```
#### 关闭housekeeper
Zabbix 2.2+
~~~
"Administration" -> "General"
History and Trends 的 "Enable internal housekeeping" 去掉
istory and Trends 的 "Override item <trend/history> period" 勾上
~~~
![Housekeeping设置](https://box.kancloud.cn/110320d14a11404a9e20731b3d11d6f4_329x291.png)
#### 换句话说,实际就是执行了以下语句
```sql
ALTER TABLE `history_str` PARTITION BY RANGE ( clock)(
PARTITION p20171 VALUES LESS THAN (UNIX_TIMESTAMP("2017-01-01 00:00:00")),
PARTITION p20172 VALUES LESS THAN (UNIX_TIMESTAMP("2017-02-01 00:00:00")),
PARTITION p20173 VALUES LESS THAN (UNIX_TIMESTAMP("2017-03-01 00:00:00")),
PARTITION p20174 VALUES LESS THAN (UNIX_TIMESTAMP("2017-04-01 00:00:00")),
PARTITION p20175 VALUES LESS THAN (UNIX_TIMESTAMP("2017-05-01 00:00:00")),
PARTITION p20176 VALUES LESS THAN (UNIX_TIMESTAMP("2017-06-01 00:00:00")),
PARTITION p20177 VALUES LESS THAN (UNIX_TIMESTAMP("2017-07-01 00:00:00")),
PARTITION p20178 VALUES LESS THAN (UNIX_TIMESTAMP("2017-08-01 00:00:00")),
PARTITION p20179 VALUES LESS THAN (UNIX_TIMESTAMP("2017-09-01 00:00:00")),
PARTITION p201710 VALUES LESS THAN (UNIX_TIMESTAMP("2017-10-01 00:00:00")),
PARTITION p201711 VALUES LESS THAN (UNIX_TIMESTAMP("2017-11-01 00:00:00")),
PARTITION p201712 VALUES LESS THAN (UNIX_TIMESTAMP("2017-12-01 00:00:00")),
PARTITION p20181 VALUES LESS THAN (UNIX_TIMESTAMP("2018-01-01 00:00:00")),
PARTITION p20182 VALUES LESS THAN (UNIX_TIMESTAMP("2018-02-01 00:00:00")),
PARTITION p20183 VALUES LESS THAN (UNIX_TIMESTAMP("2018-03-01 00:00:00")),
PARTITION p20184 VALUES LESS THAN (UNIX_TIMESTAMP("2018-04-01 00:00:00")),
PARTITION p20185 VALUES LESS THAN (UNIX_TIMESTAMP("2018-05-01 00:00:00")),
PARTITION p20186 VALUES LESS THAN (UNIX_TIMESTAMP("2018-06-01 00:00:00")),
PARTITION p20187 VALUES LESS THAN (UNIX_TIMESTAMP("2018-07-01 00:00:00")),
PARTITION p20188 VALUES LESS THAN (UNIX_TIMESTAMP("2018-08-01 00:00:00")),
PARTITION p20189 VALUES LESS THAN (UNIX_TIMESTAMP("2018-09-01 00:00:00")),
PARTITION p201810 VALUES LESS THAN (UNIX_TIMESTAMP("2018-10-01 00:00:00")),
PARTITION p201811 VALUES LESS THAN (UNIX_TIMESTAMP("2018-11-01 00:00:00")),
PARTITION p201812 VALUES LESS THAN (UNIX_TIMESTAMP("2018-12-01 00:00:00")),
PARTITION p20191 VALUES LESS THAN (UNIX_TIMESTAMP("2019-01-01 00:00:00")),
PARTITION p20192 VALUES LESS THAN (UNIX_TIMESTAMP("2019-02-01 00:00:00")),
PARTITION p20193 VALUES LESS THAN (UNIX_TIMESTAMP("2019-03-01 00:00:00")),
PARTITION p20194 VALUES LESS THAN (UNIX_TIMESTAMP("2019-04-01 00:00:00")),
PARTITION p20195 VALUES LESS THAN (UNIX_TIMESTAMP("2019-05-01 00:00:00")),
PARTITION p20196 VALUES LESS THAN (UNIX_TIMESTAMP("2019-06-01 00:00:00")),
PARTITION p20197 VALUES LESS THAN (UNIX_TIMESTAMP("2019-07-01 00:00:00")),
PARTITION p20198 VALUES LESS THAN (UNIX_TIMESTAMP("2019-08-01 00:00:00")),
PARTITION p20199 VALUES LESS THAN (UNIX_TIMESTAMP("2019-09-01 00:00:00")),
PARTITION p201910 VALUES LESS THAN (UNIX_TIMESTAMP("2019-10-01 00:00:00")),
PARTITION p201911 VALUES LESS THAN (UNIX_TIMESTAMP("2019-11-01 00:00:00")),
PARTITION p201912 VALUES LESS THAN (UNIX_TIMESTAMP("2019-12-01 00:00:00")),
PARTITION p20201 VALUES LESS THAN (UNIX_TIMESTAMP("2020-01-01 00:00:00")),
PARTITION p20202 VALUES LESS THAN (UNIX_TIMESTAMP("2020-02-01 00:00:00")),
PARTITION p20203 VALUES LESS THAN (UNIX_TIMESTAMP("2020-03-01 00:00:00")),
PARTITION p20204 VALUES LESS THAN (UNIX_TIMESTAMP("2020-04-01 00:00:00")),
PARTITION p20205 VALUES LESS THAN (UNIX_TIMESTAMP("2020-05-01 00:00:00")),
PARTITION p20206 VALUES LESS THAN (UNIX_TIMESTAMP("2020-06-01 00:00:00")),
PARTITION p20207 VALUES LESS THAN (UNIX_TIMESTAMP("2020-07-01 00:00:00")),
PARTITION p20208 VALUES LESS THAN (UNIX_TIMESTAMP("2020-08-01 00:00:00")),
PARTITION p20209 VALUES LESS THAN (UNIX_TIMESTAMP("2020-09-01 00:00:00")),
PARTITION p202010 VALUES LESS THAN (UNIX_TIMESTAMP("2020-10-01 00:00:00")),
PARTITION p202011 VALUES LESS THAN (UNIX_TIMESTAMP("2020-11-01 00:00:00")),
PARTITION p202012 VALUES LESS THAN (UNIX_TIMESTAMP("2020-12-01 00:00:00")),
PARTITION p20211 VALUES LESS THAN (UNIX_TIMESTAMP("2021-01-01 00:00:00")),
PARTITION p20212 VALUES LESS THAN (UNIX_TIMESTAMP("2021-02-01 00:00:00")),
PARTITION p20213 VALUES LESS THAN (UNIX_TIMESTAMP("2021-03-01 00:00:00")),
PARTITION p20214 VALUES LESS THAN (UNIX_TIMESTAMP("2021-04-01 00:00:00")),
PARTITION p20215 VALUES LESS THAN (UNIX_TIMESTAMP("2021-05-01 00:00:00")),
PARTITION p20216 VALUES LESS THAN (UNIX_TIMESTAMP("2021-06-01 00:00:00")),
PARTITION p20217 VALUES LESS THAN (UNIX_TIMESTAMP("2021-07-01 00:00:00")),
PARTITION p20218 VALUES LESS THAN (UNIX_TIMESTAMP("2021-08-01 00:00:00")),
PARTITION p20219 VALUES LESS THAN (UNIX_TIMESTAMP("2021-09-01 00:00:00")),
PARTITION p202110 VALUES LESS THAN (UNIX_TIMESTAMP("2021-10-01 00:00:00")),
PARTITION p202111 VALUES LESS THAN (UNIX_TIMESTAMP("2021-11-01 00:00:00")),
PARTITION p202112 VALUES LESS THAN (UNIX_TIMESTAMP("2021-12-01 00:00:00")),
PARTITION p9999 VALUES LESS VALUES LESS THAN MAXVALUE);
```
- 献给乐于奉献的你
- 一、工作感悟
- 1.1 工作感悟
- 1.2 数据库工作总结
- 二、运维专题(非技术)
- 2.1 公有云运维
- 2.1.1 阿里云采坑记.md
- 三、运维专题(技术类)
- 3.1 Linux(操作系统)
- 3.1.1 常见工作总结
- 3.1.2 常见服务使用和部署
- 3.1.3 操作系统优化
- 3.1.4 常用命令(Centos8)
- 3.2 Docker & K8s(容器技术)
- 3.2.1 Docker
- 1. Docker
- 1-1 容器基础
- 1-2 部署和加速
- 1-3 常用命令
- 1-4 Dockerfile编写
- 1-5 容器网络
- 1-6 数据持久化
- 2. docker-compose
- 2-1 基础
- 3.2.2 kubernetes
- 1. 导读-请先看我
- 2. kubeadm部署集群
- 1-1 k8s-1.14-基于calico
- 1-2 k8s-1.17-基于flanne
- 3. 二进制部署集群
- 4. 日常工作及故障处理
- 4-1 常用命令
- 4-2 故障处理
- 3.2.3 依赖服务部署
- 1. Harbor(镜像仓库)
- 1-1 harbor-2.1.0(单节点)
- 3.3 CICD(持续集成/部署)
- 3.3.1 GitLab
- 1. 服务部署
- 1-1 Gitlab-CE-13.3.4(单节点)
- 2. Git基础
- 3.3.2 Ansible
- 1. 服务部署
- 1-2 ansible-2.5(pip部署)
- 3. ansible-playbook
- 3-1 基于Roles的Playbook
- 3-3 循环语法
- 3.3.3 Jnekins
- 1. Jenkins部署
- 1-1 Jenkins-2.65部署
- 1-2 Jenkins-2.249部署
- 2. Jenkins项目初始化
- 3. Jenkins集成
- 3-1 Jenkins-2.65集成Sonar
- 3.4 LB/HA(负载均衡,反向代理)
- 3.4.1 LVS+Keepalive
- 1. LVS为MySQL读提供负载均衡
- 3.4.2 Pacemaker(HA)
- 1. 常用命令(转)
- 3.5 Runtime(代码运行环境)
- 3.5.1 Tomcat(Web中间件)
- 1. Tomcat部署手册
- 1-1 Tomcat-7.0.76部署
- 2. Tomcat常用脚本
- 3.6 NoSQL(非关系型数据库)
- 3.6.1 redis(非关系数据库)
- 1. Redis 基础
- 2. Redis 4.0变化
- 3. Codis实现Redis的集群
- 4. Redis故障处理
- 5. redis安全第一步
- 6. Redis集群搭建
- 7. CacheCloud部署
- 3.6.1 Redis挑战
- 3.6.2 MongoDB(文档数据库)
- 1. Mongodb基础
- 1-1 Mongodb4.0新特性
- 1-2 支持多大数据量
- 2. Mongodb安装
- 2-1 Mac OS安装Mongodb
- 2-2 Yum安装Mongodb
- 2-3 二进制安装Mongodb
- 2-4 docker容器安装Mongodb
- 2-5 Mongodb 配置文件详解
- 2-6 Mongodb 生产安全清单
- 2-7 用户身份认证和授权
- 3. Mongodb副本集
- 3-1 副本集搭建
- 3-2 用户身份认证与授权
- 4. 日常维护工作
- 4-1 Mongodb磁盘回收
- 4-2 Mongodb备份恢复到任意时间点
- 4-3 Mongodb慢查询分析
- 4-4 Mongodb版本升级
- 4-5 Mongodb副本集成员状态
- 4-6 Mongodb备份恢复工具使用
- 4-7 Mongodb服务启动和停止
- 4-8 修改副本集成员oplog大小
- 4-9 Mongodb 副本集Oplog
- 3.7 MQ(消息队列)
- 3.7.1 Zookeeper(分布式协调系统)
- 1. ZooKeeper基础
- 2. ZooKeeper集群搭建
- 2-1 ZK-3.4.10部署
- 3.2 RabbitMQ(消息队列)
- 1. 服务部署
- 1-1 RabbitMQ-3.8部署
- 2. 常用命令
- 3.8 Monitor(数据收集,监控)
- 3.8.1 Zabbix(运维监控)
- 1. 服务部署
- 1-1 服务端部署
- 1-2 客户端部署
- 2. 监控服务
- 2-1 监控Apache
- 2-2 监控IIS
- 2-3 监控Ningx
- 2-4 监控Tomcat(6/7/8)
- 2-5 监控WebSphere 7
- 2-6 监控MySQL
- 2-7 监控Oracle
- 2-8 监控SQL Servre
- 2-9 监控Weblogic
- 2-10 监控Windows
- 2-11 自定义监控项
- 3. 告警推送
- 3-1 邮件告警
- 3-2 短信告警
- 3-3 告警推到Syslog
- 4. 日常工作
- 4-1 数据库优化(TokuDB)
- 4-2 数据库优化(分区表)
- 4-3 前端定制(Grafana)
- 5. 与Grafana结合
- 3.8.2 ELKBstack(日志收集展示)
- 1. 服务部署
- 1-1 ELK 5.5部署及配置
- 1-1-1 ELKBstack介绍
- 1-1-2 Elasticsearch部署
- 1-1-3 Logstash部署
- 1-1-4 Kibana部署
- 1-1-5 X-pack部署
- 1-1-6 Filebeat部署
- 2. ELK高级配置
- 1. Elasticsearch实战
- 2. Logstash实战
- 3. Filebeat实战
- 5. 引入队列
- 3.9 Virtualization(虚拟化)
- 3.10 Basic(基础服务)
- 3.10.1 Piwik-Matomo(用户行为分析)
- 1. Piwik前期分析
- 2. Piwik介绍和部署
- 2-1 Piwik-3.x版本(早期)
- 3. Piwik 功能配置
- 4. Piwik 模拟数据和压测
- 5. Piwik运转原理
- 6. Piwik数据库模式(一)
- 6-1 第一部分
- 6-2 第二部分
- 3.10.2 Cobbler(系统自动部署)
- 1. Cobbler 可以干什么?
- 2. Cobbler 基础原理
- 3. Cobbler 安装
- 3-1 Cobbler-2.8部署
- 4. Cobbler 基础配置
- 5. Cobbler 配置文件
- 6. 一键优化脚本
- 3.10.3 Rsync(数据同步服务)
- 1. Rsync基础
- 2. 案例:页面部署(服务端拉取)
- 3.10.4 NFS(共享存储)
- 1. NFS部署手册
- 2. 客户端NFS备份脚本
- 3.10.5 Grafana(可视化)
- 1. 安装(8.2.x)
- 3.11 Tools(软件工具)
- 3.11.1 基准测试
- 1. 基准测试方法论
- 2. 压测工具 - Siege
- 3. 压测工具 - http_load
- 3.12 DB(关系型数据库)
- 3.12.1 MySQL(关系数据库)
- 1. MySQL部署
- 1-1 MySQL-5.7部署
- 1-2 Percona-5.7 + TokuDB 部署
- 2. MySQL复制
- 2-1 MySQL异步复制
- 3. MySQL备份恢复
- 3-1 xtrabackup 备份恢复
- 4. MySQL 高可用
- 4-1 MHA(HA)
- 4-1-1 MHA 架构介绍和原理
- 4-1-2 MHA日常管理
- 4-1-3 MHA 自动Failover
- 4-1-4 MHA常用参数
- 4-1-5 MHA 报错
- 4-1-6 MHA相关配置文件和脚本
- 4-2 MyCAT
- 4-2-1 MyCAT 介绍和部署
- 4-1-3 MyCAT读写分离案例解析
- 5. MySQL 常用脚本
- 5-1 MySQL常用统计语句
- 5-2 MySQL性能分析脚本
- 6. MySQL 日常及故障处理
- 6-1 MySQL死锁排查
- 6-2 复制故障
- 6-3 MySQL 升级注意事项
- 6-3 MySQL授权
- 3.12.2 Oracle(关系数据库)
- 1. Oracle部署
- 1-1 Oracle11g单实例部署
- 1-2 Oracle12c单实例部署
- 2. Oracle常用脚本
- 3. Oracle 知识点
- 六、Ansible开源项目
- 6.1 项目初始化手册
- 6.1.1 Ansible错误处理
- 6.1.2 一种预先判断是否操作的方法
- 6.2 System初始化
- 6.3 Nginx/Tnginx部署
- 6.4 Python部署
- 6.5 PHP部署
- 6.6 MySQL部署
- 6.7 Docker部署
- 6.8 Haproxy部署
- 6.9 Redis部署
- 1. 变量和tags信息
- 3. Redis主从部署
- 4. Redis集群部署
- 5. 清理数据
- 6.10 Software软件部署
- 6.11 Zabbix部署
- 6.12 Elastic部署
- 6.13 Tomcat
- 6.14 Kafka部署
- 6.15 Zookeeper部署
- 6.16 Etcd集群部署
- 6.17 M3DB部署
- 6.18 Pormetheus部署
- 七、学习资源推荐
- 八、从瞎搞到放弃
- 8.1 CodeQL(语义代码分析引擎)
- 8.1.1 背景及计划
- 8.1.2 CodeQL概述
- 8.1.3 简单部署和使用
- 8.1.4 后续
- 8.2 dbdeployer(轻松部署MySQL)
- 归档笔记
- 三、常用服务部署(迁移中)
- 3.4 Nginx & PHP(Web服务)
- 3.4.1 Nginx(Web)
- 1. Nginx基础和部署
- 2. Nginx 我的一些思考
- 3. Nginx(Web)配置
- 4. Nginx(Proxy)配置
- 5. Nginx日常管理
- 3.4.3 PHP
- 1. PHP 7.1 部署
- 2. PHP5.6 部署
- 4. PHP原理
- 5. PHP 常用模块
- 二、运维项目实战(迁移中)
- 2.1 标准化 & 工具化项目
- 2.1.1 系统部署和优化
- 2.1.5 全网日志收集展示平台项目
- 1. 项目需求
- 2. 整体方案规划
- 3. 日志收集配置
- 4. 消息缓冲队列
- 5. 日志处理转发
- 6. 日志数据展示(待补充)
- 7. ELK安全配置(上)
- 8. ELK安全配置(下)
- 9. 项目总结
- 2.2 高性能Web项目
- 2.2.1 网站需求(完善中)