Skip to content

Instantly share code, notes, and snippets.

View rockysays's full-sized avatar

Rocky Wang rockysays

  • yintianxia
  • shanghai
View GitHub Profile
@rockysays
rockysays / nginx_deployment.yaml
Created January 6, 2019 17:22 — forked from petitviolet/nginx_deployment.yaml
sample Nginx configuration on Kubernetes using ConfigMap to configure nginx.
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-conf
data:
nginx.conf: |
user nginx;
worker_processes 3;
error_log /var/log/nginx/error.log;
events {
@rockysays
rockysays / 1_kubernetes_on_macOS.md
Created July 1, 2018 11:01 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

@rockysays
rockysays / haproxy.sh
Created July 15, 2017 10:30 — forked from trungv0/haproxy.sh
RabbitMQ cluster with HAProxy & Keepalived for high availability
# install haproxy
yum install -y haproxy
# config haproxy for rabbitmq
cat > /etc/haproxy/haproxy.cfg << "EOF"
global
log 127.0.0.1 local0 notice
maxconn 10000
user haproxy
@rockysays
rockysays / kafka
Created June 12, 2017 13:51 — forked from wgriffiths/kafka
Init script for Apache Kafka
#! /bin/sh
### BEGIN INIT INFO
# Provides: kafka
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: a distributed commit log.
# Description: Apache Kafka is publish-subscribe messaging rethought
# as a distributed commit log.
@rockysays
rockysays / kafka-service-script
Created June 12, 2017 13:50 — forked from mottyc/kafka-service-script
Kafka service script (copy to file: /etc/init.d/kafka)
#! /bin/sh
# /etc/init.d/kafka: start the kafka daemon.
# chkconfig: - 80 20
# description: kafka
KAFKA_HOME=/usr/share/kafka
KAFKA_USER=root
KAFKA_SCRIPT=$KAFKA_HOME/bin/kafka-server-start.sh
KAFKA_CONFIG=$KAFKA_HOME/config/server.properties
@rockysays
rockysays / tcpstats.sh
Created October 28, 2015 07:10 — forked from andreipak/tcpstats.sh
TCP Connections Stats for Zabbix
#!/bin/bash
/sbin/ss -ant | awk "{if (NR>1) {state[\$1]++}} END {host = \"-\"; \
for (i in state) {s=i; \
sub (/ESTAB/, \"establ\", s); sub (/LISTEN/, \"listen\", s); sub (/SYN-SENT/, \"synsent\", s); \
sub (/SYN-RECV/, \"synrecv\", s); sub (/FIN-WAIT-1/, \"finw1\", s); sub (/FIN-WAIT-2/, \"finw2\", s); \
sub (/CLOSE-WAIT/, \"closew\", s); sub (/TIME-WAIT/, \"timew\", s); print host, \"tcp.\"s, state[i]}}" \
| /usr/bin/zabbix_sender -vv -c /etc/zabbix/zabbix_agentd.conf -i - 2>&1
echo "1"
exit 0
@rockysays
rockysays / memusg
Last active August 29, 2015 14:23 — forked from netj/memusg
#!/usr/bin/env bash
# memusg -- Measure memory usage of processes
# Usage: memusg COMMAND [ARGS]...
#
# Author: Jaeho Shin <[email protected]>
# Created: 2010-08-16
set -um
# check input
[ $# -gt 0 ] || { sed -n '2,/^#$/ s/^# //p' <"$0"; exit 1; }
@rockysays
rockysays / proc_mem.sh
Last active August 29, 2015 14:23 — forked from alice-xu/proc_mem.sh
#!/usr/bin/env bash
#
# proc_mem.sh:
# Process memory monitoring script for Zabbix
#
# $1: process name
# $2: effective user name
# $3: mode(sum/max/min/avg)
# $4: args pattern
#
@rockysays
rockysays / ncp
Last active August 29, 2015 14:20 — forked from godber/ncp
#! /usr/bin/bash
# ncp - Netcat and Pigz based network file copy (faster than scp, but unencrypted)
# From this blog post
# http://intermediatesql.com/linux/scrap-the-scp-how-to-copy-data-fast-using-pigz-and-nc/
FILE_FULL=$1
REMOTE_HOST=$2
FILE_DIR=$(dirname $FILE_FULL)