reids5.0集群搭建
三种模式:主从: 高可用性,读写分离,M写S读。故障时无法自动切换,只能手动,master存储和写能力因机器收到瓶颈哨兵: 实现故障发现、故障转移、配置中心、客户端通知,哨兵可以从字面理解。他会持续性监视主从之间的状态信息,当主从故障自动切换集群: 去中心化分片集群,集群中有16384个哈希槽,每个redis实例负责一部分slot,集群中的所有信息通过节点数据交换而更新。卡槽只会分配给主节点,每个卡槽能存放多key。有利于Redis动态扩容、缩容,把缓存雪崩数据丢失的风险降到最小。 集群搭建传送门: 安装包官方下载地址 主机 端口 角色 10.6.6.69 6379/6380 master/slave 10.6.6.70 6379/6380 master/slave 10.6.6.71 6379/6380 master/slave 以下步骤在所需节点相同,此处只演示一台节点 redis是c语言写的,下载环境1[root@report-redis1 ~]# yum install lrzsz w...
redis5.0参数详解
官网: 原文 #Redis 配置文件示例。 #注意,为了读取配置文件,Redis 必须是#以文件路径作为第一个参数开始: #./redis-server /path/to/redis.conf #单位注意事项:当需要内存大小时,可以指定#它以通常的形式 1k 5GB 4M 等等: #1k => 1000 字节#1kb => 1024 字节#1m => 1000000 字节#1mb => 10241024 字节#1g => 1000000000 字节#1GB => 10241024*1024 字节 #单位不区分大小写,因此 1GB 1Gb 1gB 都是一样的。 #################################包括################################### #在此处包含一个或多个其他配置文件。这很有用,如果你#有一个标准模板去所有 Redis 服务器,但也需要#自定义一些每个服务器的设置。包含文件可以包含...
ssh创建密钥ansible批量分发
ssh-keygen命令 用于为“ssh”生成、管理和转换认证密钥,它支持RSA和DSA两种认证密钥SSH 密钥默认保留在 ~/.ssh 目录中id_rsa:私钥文件id_rsa.pub:公钥文件known_hosts:ssh访问不同的主机会将公钥记录到此文件,每次访问会核对密钥 创建ssh密钥123456789101112131415161718192021[root@ceshi-128 ~]# ssh-keygen -t rsaGenerating public/private rsa key pair.Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa.Your public key has been saved in /root/.ssh/id_r...
环境变量/etc/profile /etc/bashrc
问题:配置环境变量CATALINA_OPTS开启jmx监控 1export CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=12345 -Djava.rmi.server.hostname=${IP}" 配置在/etc/profile中本地启动tomcat正常无影响,远程使用jenkins启动无效 配置在/etc/bashrc中jenkins+ansible远程批量启动正常 /etc/profile:简单来说是给login shell提供全局环境变量/etc/bashrc:简单来说是给nologin shell提供全局环境变量
crontab每周一到周五
每周一到周五9点到15点每分钟执行:*/1 9-14 * * 1-5123456789Linux * * * * * - - - - - | | | | | | | | | +----- day of week (0 - 7) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat | | | +---------- month (1 - 12) OR jan,feb,mar,apr ... | | +--------------- day of month (1 - 31) | +-------------------- hour (0 - 23) +------------------------- minute (0 - 59) 字段 备注 Minutes 分(0–59) Hours 时(0–59) Day 日(1–31) ...
curl检测域名证书到期时间
公司业务会使用ssl证书来确保域名安全被访问,免费证书现在有效期为三个月更换频率比较快,使用curl命令进行检测然后根据对应监控软件进行提前告警关注 脚本内容curl: -I 获取http头部响应信息 -v 显示详细操作信息 -s 静默输出 1234567891011121314151617#!/bin/bash#以百度为例URL=https://www.baidu.com#获取证书到期时间expiry_date=$(curl -Ivs --connect-timeout 30 $URL 2>&1 | awk -F': |GMT' '/expire date/{print$2}')#将日期转换为秒date_seconds=$(date -d "$expiry_date" +%s)#获取当前时间秒数now_seconds=$(date +%s)#将到期秒数减去当前秒数diff_seconds=$((date_seconds - now_seconds))#除掉86400秒即可算出剩余天数...
prometheus-promQL语法
运算 Value + 加法 - 减法 * 乘法 / 除法 % 求余 ^ 幂运算 == 相等 !== 不相等 > 大于 < 小于 >== 大于等于 <== 小于等于 and 并且 or 或者 unless 排除 12以MB方式获取当前主机空闲内存空间node_memory_free_bytes_total / (1024 * 1024) 12磁盘读+写计算磁盘io的byte数值node_disk_written_bytes_total + node_disk_read_bytes_total 12计算空闲内存百分比(总-空闲 / 总)(node_memory_MemTotal_bytes - node_memory_MemFree_bytes) / node_memory_MemTotal_bytes 12计算空闲内存百分比并大于0.95(node_memory_MemTotal_bytes...
prometheus+consul服务发现
常见几种服务发现模式 静态服务发现: 123- job_name: 'test' static_configs: - targets: ['10.1.74.109:9104'] 文件服务发现:周期性自动检查特定文件内容读取加载到配置,不需要重启 123456- job_name: 'file_sd_test' file_sd_configs: - refresh_interval: 15s files: - /data/prometheus/*.yml - /data/prometheus/*.json yml格式: 12345- targets: ['10.1.74.109:9100'] labels: app: 'ceshi' env: 'dev' region: 'dev-1' consul:面向分布式,提供服务注册、服务发现和配置管理。通过export...
prometheus+cadvisor监控docker
官方解释 cAdvisor(ContainerAdvisor)为容器用户提供了对其运行容器的资源使用和性能特性的了解。它是一个正在运行的守护程序,用于收集、聚合、处理和导出有关正在运行的容器的信息。具体来说,它为每个容器保存资源隔离参数、历史资源使用情况、完整历史资源使用的直方图和网络统计信息。该数据按容器和机器范围导出。 说白了其实和一般监控的agent类似,就是将容器内部的监控指标持久化存储然后web ui界面展示,结合prometheus+grafana更好的汇聚监控指标 docker部署12345678910111213141516[root@zabbix cadvisor]# cat docker-cadvisor.yml version: "3.5"services: cadvisor: image: harbor.od.com/prometheus/cadvisor:latest container_name: cadvisor volumes: - /:/rootfs:ro - /var/run:/va...
prometheus-metrics指标翻译
cadvisor1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253cadvisor_version_info: cAdvisor 版本信息container_cpu_cfs_periods_total: CFS (Completely Fair Scheduler) 周期总数container_cpu_cfs_throttled_periods_total: 受 CFS throttling 的周期总数container_cpu_cfs_throttled_seconds_total: 受 CFS throttling 的秒数总数container_cpu_load_average_10s: 容器 CPU 的 10 秒平均负载container_cpu_system_seconds_total: CPU 在系统模式下的使用总时间container_cpu_usage_seconds_total: CPU 的总使用时间container_c...















