Переделал Makefile
parent
847fb042a0
commit
2630d17d78
41
Makefile
41
Makefile
|
@ -1,38 +1,35 @@
|
|||
cdir = $(shell pwd)
|
||||
|
||||
app-up:
|
||||
docker-compose -f ./cicd/docker-compose.yml up -d --build ; \
|
||||
./cicd/init.sh
|
||||
docker-compose -f ./cicd/dc_app.yml up -d --build ; \
|
||||
|
||||
app-down:
|
||||
docker-compose -f ./cicd/docker-compose.yml down ; \
|
||||
docker rmi $$(sudo docker images -a | grep '<none>' | awk '{print $$3}') ; \
|
||||
rm -rf /opt/mysql_slave1/* ; \
|
||||
rm -rf /opt/mysql_slave2/*
|
||||
docker-compose -f ./cicd/dc_app.yml down ; \
|
||||
|
||||
app-reload:
|
||||
docker-compose -f ./cicd/docker-compose.yml down ; \
|
||||
docker-compose -f ./cicd/docker-compose.yml up -d ; \
|
||||
./cicd/init.sh
|
||||
docker-compose -f ./cicd/dc_app.yml down ; \
|
||||
docker-compose -f ./cicd/dc_app.yml up -d
|
||||
|
||||
db-up:
|
||||
rm -rf /opt/mysql_slave1/* ; \
|
||||
rm -rf /opt/mysql_slave2/* ; \
|
||||
docker-compose -f ./cicd/dc_db.yml up -d --build ; \
|
||||
./cicd/init.sh ; \
|
||||
|
||||
db-down:
|
||||
docker-compose -f ./cicd/dc_db.yml down
|
||||
|
||||
prom-up:
|
||||
docker-compose -f ./test/monitor/docker-compose.yml up -d --build
|
||||
|
||||
prom-down:
|
||||
docker-compose -f ./test/monitor/docker-compose.yml down ; \
|
||||
|
||||
up: db-up app-up prom-up
|
||||
|
||||
down: prom-down app-down db-down
|
||||
|
||||
clean:
|
||||
docker rmi $$(sudo docker images -a | grep '<none>' | awk '{print $$3}')
|
||||
|
||||
up:
|
||||
rm -rf /opt/mysql_slave1/* ; \
|
||||
rm -rf /opt/mysql_slave2/* ; \
|
||||
docker-compose -f ./cicd/docker-compose.yml up -d --build ; \
|
||||
./cicd/init.sh
|
||||
docker-compose -f ./test/monitor/docker-compose.yml up -d --build ; \
|
||||
|
||||
down:
|
||||
docker-compose -f ./test/monitor/docker-compose.yml down ; \
|
||||
docker-compose -f ./cicd/docker-compose.yml down ; \
|
||||
docker rmi $$(sudo docker images -a | grep '<none>' | awk '{print $$3}')
|
||||
|
||||
|
||||
.PHONY: app-up app-down app-reload prom-up prom-down up down
|
|
@ -0,0 +1,18 @@
|
|||
version: '3'
|
||||
services:
|
||||
|
||||
app:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: ./cicd/app/Dockerfile
|
||||
restart: always
|
||||
environment:
|
||||
APP_SERVER_ADDRESS: 0.0.0.0
|
||||
APP_SERVER_PORT: 8080
|
||||
APP_DSN_MASTER: mysql_master
|
||||
APP_DSN_PORT: 3306
|
||||
APP_DSN_USER: app
|
||||
APP_DSN_PASS: app
|
||||
APP_DSN_BASE: app
|
||||
ports:
|
||||
- "8080:8080"
|
|
@ -43,19 +43,3 @@ services:
|
|||
volumes:
|
||||
- ./mysql/mysql_slave2.conf:/etc/mysql/conf.d/mysql.conf.cnf
|
||||
- /opt/mysql_slave2:/var/lib/mysql
|
||||
|
||||
app:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: ./cicd/app/Dockerfile
|
||||
restart: always
|
||||
environment:
|
||||
APP_SERVER_ADDRESS: 0.0.0.0
|
||||
APP_SERVER_PORT: 8080
|
||||
APP_DSN_MASTER: mysql_master
|
||||
APP_DSN_PORT: 3306
|
||||
APP_DSN_USER: app
|
||||
APP_DSN_PASS: app
|
||||
APP_DSN_BASE: app
|
||||
ports:
|
||||
- "8080:8080"
|
|
@ -192,34 +192,3 @@ binlog_do_db = app
|
|||
### 11. Заканчиваем нагрузку на запись.
|
||||
### 12. Выбираем самый свежий слейв. Промоутим его до мастера. Переключаем на него второй слейв.
|
||||
### 13. Проверяем, есть ли потери транзакций.
|
||||
|
||||
|
||||
|
||||
|
||||
Встроен запуск prometeus, grafana и т.д.
|
||||
Графана доступна на http://localhost:3001/
|
||||
|
||||
$ sudo docker run --rm -v /root/scripts:/scripts williamyeh/wrk -t1 -c10 -d5m --timeout 30s http://192.168.1.66:8080/search -s /scripts/post.lua -- debug true
|
||||
Running 5m test @ http://192.168.1.66:8080/search
|
||||
1 threads and 10 connections
|
||||
Thread Stats Avg Stdev Max +/- Stdev
|
||||
Latency 5.83s 1.74s 13.29s 77.58%
|
||||
Req/Sec 3.57 4.74 30.00 82.50%
|
||||
511 requests in 5.00m, 18.69MB read
|
||||
Requests/sec: 1.70
|
||||
Transfer/sec: 63.79KB
|
||||
|
||||
$ sudo make app-reload
|
||||
...
|
||||
...
|
||||
...
|
||||
$ sudo docker run --rm -v /root/scripts:/scripts williamyeh/wrk -t1 -c10 -d5m --timeout 30s http://192.168.1.66:8080/search -s /scripts/post.lua -- debug true
|
||||
Running 5m test @ http://192.168.1.66:8080/search
|
||||
1 threads and 10 connections
|
||||
Thread Stats Avg Stdev Max +/- Stdev
|
||||
Latency 32.12ms 31.59ms 561.62ms 90.65%
|
||||
Req/Sec 373.34 147.37 610.00 68.45%
|
||||
110834 requests in 5.00m, 433.90MB read
|
||||
Non-2xx or 3xx responses: 110834
|
||||
Requests/sec: 369.39
|
||||
Transfer/sec: 1.45MB
|
Loading…
Reference in New Issue