Skip to content

Instantly share code, notes, and snippets.

# 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 December 1, 2017 05:50
HAProxy configuration file with Aurora endpoints
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 August 31, 2017 05:29
hello-apex/functions/python-sample/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 August 31, 2017 05:26
hello-apex/functions/helloworld-python/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 August 31, 2017 05:24
hello-apex/functions/helloworld-python/requirements.txt
requests==2.18.2
@uorat
uorat / hello-apex-pip-function.json
Created August 31, 2017 05:22
hello-apex/functions/helloworld-python/functions.json
{
"runtime": "python3.6",
"hooks": {
"build": "pip install -r requirements.txt -t ."
}
}
@uorat
uorat / hello-apex-golang-sample-function.json
Last active August 31, 2017 05:20
hello-apex/functions/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 July 31, 2017 03:08
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 July 31, 2017 03:07
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 July 31, 2017 03:06
hello-apex/project_dev.json
{
"name": "hello-apex",
"description": "hello-apex: sample programs",
"memory": 128,
"timeout": 5,
"nameTemplate": "dev-{{.Project.Name}}_{{.Function.Name}}"
}