Skip to content

Instantly share code, notes, and snippets.

View yangvipguang's full-sized avatar
🏠
Working from home

杨光 yangvipguang

🏠
Working from home
View GitHub Profile
@yangvipguang
yangvipguang / Linux-Initial.sh
Last active June 27, 2018 02:16
Linux-Initial.sh
#!/bin/bash
##this shell script is for new server's initial
##update
yum groupinstall "Development Tools" -y && yum update -y && yum install epel-release -y && yum upgrade -y && yum install wget tar lrzsz htop tcpdump iotop iftop pcre pcre-devel
echo "update is ok"
apt-get install libsnmp-dev libiksemel-dev libxml2-dev libcurl3-dev libcurl4-openssl-dev libopenipmi-dev libssh2-1-dev unixodbc-dev libldap2-dev libpcre3 libpcre3-dev
##install zabbix_agent
cd /opt/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yangvipguang
yangvipguang / Keepalived 安装配置
Created January 8, 2018 03:26
Keepalived 安装配置
安装
yum install libnl-3-devel libnfnetlink-devel
./configure --with-init=systemd --prefix=/etc/keepalived/ --enable-profile --enable-mem-check
make && make install
systemctl unmask keepalived
systemctl enable keepalived
配置文件keepalived.conf
# Configuration File for keepalived
global_defs {
notification_email {
@yangvipguang
yangvipguang / Redis-Cluster configuration 脚本
Created December 25, 2017 08:26
Redis-Cluster configuration 脚本
#!/bin/bash
###NOTE########
#data and config of Redis Cluster ##
a=7001
while [ $a -le 7006 ]
do
cd $a
cp /etc/redis/6666.conf $a.conf ##default.conf
sed -i "s/6666/$a/g" $a.conf ##TIPS:must used "" insted of ' ' because of $
@yangvipguang
yangvipguang / haproxy 动静分离配置模板
Created November 14, 2017 06:48
haproxy 动静分离配置模板
global
# to have these messages end up in /var/log/haproxy.log you will
# need to:
# by adding the '-r' option to the SYSLOGD_OPTIONS in
# /etc/sysconfig/syslog
#
# 2) configure local2 events to go to the /var/log/haproxy.log
# file. A line like the following can be added to
# /etc/sysconfig/syslog
#
@yangvipguang
yangvipguang / gist:a166052a67eac949b3c11c47d788d778
Created November 14, 2017 06:45
Keepalived.conf 配置文件模板
vrrp_instance VI_1 { #定义VRRP实例,实例名自定义
state MASTER #指定Keepalived的角色,MASTER为主服务器,BACKUP为备用服务器
interface eth0 #指定HA监测的接口
virtual_router_id 51 #虚拟路由标识(1-255),在一个VRRP实例中主备服务器ID必须一样
priority 100 #优先级,数字越大越优先,主服务器优先级必须高于备服务器
advert_int 1 #设置主备之间同步检查时间间隔,单位秒
authentication { #设置验证类型和密码
auth_type PASS #验证类型
auth_pass ab007 #设置验证密码,同一实例中主备密码要保持一致
}
@yangvipguang
yangvipguang / nginx VHOST PHP
Last active November 14, 2017 06:31
Nginx VHOST PHP 配置模板
server {
listen 80;
server_name localhost;
location / {
root html;
index index.php index.html index.htm;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
@yangvipguang
yangvipguang / haproxy 配置文件模板
Created November 9, 2017 01:59
haproxy 配置文件模板
#
# This is a sample configuration.
#
########Part 1 Global##################################################
global
maxconn 10000 ##默认最大连接数
stats socket /var/run/haproxy.stat mode 600 level admin
log 127.0.0.1 local0
user haproxy
group haproxy
@yangvipguang
yangvipguang / IPtables 防火墙通用规则
Last active November 27, 2019 03:19
IPtables 防火墙通用规则
#!/bin/bash
# 1.定义基本变量
INET_IF="eth1" #外网接口
INET_IP="115.28.167.215" #外网接口地址
LAN_IF="eth0" #内网接口
LAN_IP="10.144.168.27" #内网接口地址
#LAN_NET="192.168.1.0/24" #内网网段
#LAN_WWW_IP="192.168.1.7" #网站服务器的内部地址
IPT="/sbin/iptables" #iptables命令的路径
MOD="/sbin/modprobe" #modprode命令的路径
@yangvipguang
yangvipguang / RedisMonitor.sh
Created August 15, 2017 07:53
Redis 监控脚本
#! /bin/bash
#Name: redismontior.sh
#From: zhangm412@126.com <2014/08/06>
#Action: Zabbix monitoring redis plug-in
REDISCLI="/usr/local/redis/src/redis-cli"
HOST="192.168.1.50"
PORT=6379
if [[ $# == 1 ]];then