Skip to content

Instantly share code, notes, and snippets.

View change-weight-with-ansible.sh
# 1. 継続利用する Node Endpoint read1 - 3 の weight を 1 にする
ansible -m 'shell' -i production haproxy -s -a'echo "set weight mysql/reader1 1" | sudo socat stdio /var/lib/haproxy/stats'
ansible -m 'shell' -i production haproxy -s -a'echo "set weight mysql/reader2 1" | sudo socat stdio /var/lib/haproxy/stats'
ansible -m 'shell' -i production haproxy -s -a'echo "set weight mysql/reader3 1" | sudo socat stdio /var/lib/haproxy/stats'
# 2. Reader Endpoint 経由でクエリが流れないように Reader Endpoint の weight を 0 にする
ansible -m 'shell' -i production haproxy -s -a'echo "set weight mysql/reader 0" | sudo socat stdio /var/lib/haproxy/stats'
@uorat
uorat / haproxy.aurora.endpoints.cfg
Created Dec 1, 2017
HAProxy configuration file with Aurora endpoints
View haproxy.aurora.endpoints.cfg
global
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4096
user haproxy
group haproxy
daemon
stats socket /var/lib/haproxy/stats user root group root level admin
@uorat
uorat / hello-apex-inspect-path-main.py
Created Aug 31, 2017
hello-apex/functions/python-sample/main.py
View hello-apex-inspect-path-main.py
from __future__ import print_function
import sys
import os
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def handle(event, context):
logger.info("$ENV: " + str(os.environ))
@uorat
uorat / hello-apex-pip-site-package-functions.json
Created Aug 31, 2017
hello-apex/functions/helloworld-python/functions.json
View hello-apex-pip-site-package-functions.json
{
"runtime": "python3.6",
"hooks": {
"build": "pip install -r requirements.txt -t ./site-packages"
},
"environment": {
"PYTHONPATH": "/var/runtime:/var/task/site-packages"
}
}
@uorat
uorat / hello-apex-pip-requirements.txt
Last active Aug 31, 2017
hello-apex/functions/helloworld-python/requirements.txt
@uorat
uorat / hello-apex-pip-function.json
Created Aug 31, 2017
hello-apex/functions/helloworld-python/functions.json
View hello-apex-pip-function.json
{
"runtime": "python3.6",
"hooks": {
"build": "pip install -r requirements.txt -t ."
}
}
@uorat
uorat / hello-apex-golang-sample-function.json
Last active Aug 31, 2017
hello-apex/functions/golang-sample/function.json
View hello-apex-golang-sample-function.json
{
"hooks": {
"build": "GOOS=linux GOARCH=amd64 go build -o main main.go",
"clean": "rm -f main"
}
}
@uorat
uorat / hello-apex-project_prod.json
Created Jul 31, 2017
hello-apex/project_prod.json
View hello-apex-project_prod.json
{
"name": "hello-apex",
"description": "hello-apex: sample programs",
"memory": 128,
"timeout": 5,
"nameTemplate": "prod-{{.Project.Name}}_{{.Function.Name}}"
}
@uorat
uorat / hello-apex-project_stage.json
Created Jul 31, 2017
hello-apex/project_stage.json
View hello-apex-project_stage.json
{
"name": "hello-apex",
"description": "hello-apex: sample programs",
"memory": 128,
"timeout": 5,
"nameTemplate": "stage-{{.Project.Name}}_{{.Function.Name}}"
}
@uorat
uorat / hello-apex-project_dev.json
Created Jul 31, 2017
hello-apex/project_dev.json
View hello-apex-project_dev.json
{
"name": "hello-apex",
"description": "hello-apex: sample programs",
"memory": 128,
"timeout": 5,
"nameTemplate": "dev-{{.Project.Name}}_{{.Function.Name}}"
}