Skip to content

Commit

Permalink
add make help, add muta apm switch
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangxianliang007 committed Jul 14, 2020
1 parent 2ecab2c commit 08e60ca
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 32 deletions.
44 changes: 18 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,54 +1,46 @@
# init servers env
init:
.DEFAULT_GOAL:=help

init: ## init servers env
ansible-playbook -i hosts init_server.yml

# deploy prometheus
prometheus:
prometheus: ## deploy prometheus and grafana
ansible-playbook -i hosts deploy_prometheus.yml

# deploy jaeger server
jaeger:
jaeger: ## deploy jaeger server
ansible-playbook -i hosts deploy_jaeger.yml

# deploy muta exporter
exporter:
exporter: ## deploy muta monitor exporter
server=`grep -A 1 "\[jaeger_server\]" hosts | grep -v "\[jaeger_server\]"`; \
ansible-playbook -i hosts deploy_exporter.yml --extra-vars "jaeger_server=$$server"

# run muta-chain benchmark
benchmark:
benchmark: ## run muta-chain benchmark
ansible-playbook -i hosts deploy_benchmark.yml

# deploy muta-chain services
muta:
muta: ## deploy muta-chain services
ansible-playbook -i hosts deploy_muta.yml

# start all muta-chain services as daemon
start:
start: ## start all muta-chain services as daemon
@echo "[start]Starting all services"
ansible-playbook -i hosts deploy_muta.yml --skip-tags build_config -t start

# restart all muta-chain services
restart:
restart: ## restart all muta-chain services
ansible-playbook -i hosts deploy_muta.yml --skip-tags build_config -t "stop,start"

# stop all muta-chain services
stop:
stop: ## stop all muta-chain services
@echo "[stop]Stop all services"
ansible-playbook -i hosts deploy_muta.yml --skip-tags build_config -t stop

# delete all muta-chain data
clear:
clear: ## delete all muta-chain data
ansible-playbook -i hosts deploy_muta.yml --skip-tags build_config -t "stop,clear"

# build muta-chain binary
build:
build: ## build muta-chain binary
ansible-playbook -i hosts build_muta.yml

# list muta-chain process
ps:
ps: ## list muta-chain process
ansible -i hosts muta_node -m shell -a "ps -ef | grep muta-chain | grep -v grep"

# Test node availability
test:
test: ## Test node availability
ansible -i hosts allhost -m ping

help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-10s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
13 changes: 8 additions & 5 deletions build_muta_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,16 @@ def muta_config():
node_config["logger"]["log_path"] = os.path.join(config["muta"]["data_path"], "logs")
node_config["logger"]["log_to_file"] = config["logger"]["log_to_file"]
node_config["logger"]["metrics"] = config["logger"]["metrics"]


node_config["rocksdb"]["max_open_files"] = config["rocksdb"]["max_open_files"]

private_address = keypair["address"]
node_ip = node_list[i]
node_config["apm"] = {}
node_config["apm"]["service_name"] = config["apm"]["service_name"] + "-" + node_ip + "-" + private_address
node_config["apm"]["tracing_address"] = config["apm"]["tracing_address"]
node_config["apm"]["tracing_batch_size"] = config["apm"]["tracing_batch_size"]
if config["apm"]["apm_open"] == 1:
node_config["apm"] = {}
node_config["apm"]["service_name"] = config["apm"]["service_name"] + "-" + node_ip + "-" + private_address
node_config["apm"]["tracing_address"] = config["apm"]["tracing_address"]
node_config["apm"]["tracing_batch_size"] = config["apm"]["tracing_batch_size"]

with open("./roles/muta/templates/config_%s.toml.j2" % (node_ip), "w") as f:
toml.dump(node_config, f)
Expand Down
3 changes: 2 additions & 1 deletion config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ log_to_file = true
metrics = true

[rocksdb]
max_open_files = 64
max_open_files = 1024

[apm]
apm_open = 1
service_name = "muta"
tracing_address = "127.0.0.1:6831"
tracing_batch_size = 50

0 comments on commit 08e60ca

Please sign in to comment.