From 08e60ca2f84eebe790909236c97d2ace20f4de22 Mon Sep 17 00:00:00 2001 From: you Date: Tue, 14 Jul 2020 14:10:27 +0800 Subject: [PATCH] add make help, add muta apm switch --- Makefile | 44 ++++++++++++++++++-------------------------- build_muta_config.py | 13 ++++++++----- config/config.toml | 3 ++- 3 files changed, 28 insertions(+), 32 deletions(-) diff --git a/Makefile b/Makefile index d9247b4..bdd72f7 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/build_muta_config.py b/build_muta_config.py index 618df6a..895b7d6 100644 --- a/build_muta_config.py +++ b/build_muta_config.py @@ -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) diff --git a/config/config.toml b/config/config.toml index bf5112d..78b4b4c 100644 --- a/config/config.toml +++ b/config/config.toml @@ -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