diff --git a/carrera-prod/README.md b/carrera-prod/README.md new file mode 100644 index 0000000..a594854 --- /dev/null +++ b/carrera-prod/README.md @@ -0,0 +1,23 @@ +## DDMQ PROD ## + +1、创建自定义网络: + +* docker network create --subnet=172.18.0.0/16 ddmq-net +* docker network ls + +2、将carrera-prod/mysql/ddmq.sql导入宿主机MySQL的carrera_open_source库 + +* 这里宿主机的MySQL的root账号密码是wawa521 +* 需要修改账号和密码,需要修改carrera-console/carrera-console/setting/carrera-console-dev.properties文件,并且重新编译 + +3、修改启动脚本 + +* 这里宿主机IP是192.168.11.24,请将carrera-prod/play.sh里面的192.168.11.24改为实际宿主机的IP +* mkdir -p /usr/local/var/rocketmq +* chmod 777 /usr/local/var/rocketmq +* 在docker中设置共享目录 /usr/local/var/rocketmq + +4、启动集群 + +* sh carrera-prod/play.sh + diff --git a/carrera-prod/build.sh b/carrera-prod/build.sh new file mode 100755 index 0000000..8967049 --- /dev/null +++ b/carrera-prod/build.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +(cd ../carrera-common && mvn clean install -DskipTests) +(cd ../carrera-sdk/consumer/java/carrera-consumer-sdk && mvn clean install -DskipTests) +(cd ../carrera-sdk/producer/java/carrera-producer-sdk && mvn clean install -DskipTests) + +../carrera-producer/build.sh && cp ../carrera-producer/target/carrera-producer-1.0.0-SNAPSHOT-jar-with-dependencies.jar n01/producer/ && cp ../carrera-producer/target/carrera-producer-1.0.0-SNAPSHOT-jar-with-dependencies.jar n02/producer/ && cp ../carrera-producer/target/carrera-producer-1.0.0-SNAPSHOT-jar-with-dependencies.jar n03/producer/ +../carrera-consumer/build.sh && cp ../carrera-consumer/target/carrera-consumer-1.0.0-SNAPSHOT-jar-with-dependencies.jar n01/consumer/ && cp ../carrera-consumer/target/carrera-consumer-1.0.0-SNAPSHOT-jar-with-dependencies.jar n02/consumer/ && cp ../carrera-consumer/target/carrera-consumer-1.0.0-SNAPSHOT-jar-with-dependencies.jar n03/consumer/ +../carrera-chronos/build.sh && cp ../carrera-chronos/target/chronos-1.0.0-SNAPSHOT-jar-with-dependencies.jar n01/chronos/ && cp ../carrera-chronos/target/chronos-1.0.0-SNAPSHOT-jar-with-dependencies.jar n02/chronos/ +../carrera-console/build.sh && cp ../carrera-console/carrera-console/target/carrera.war n01/console/ && cp ../carrera-console/carrera-console/target/carrera.war n02/console/ && cp ../carrera-console/carrera-console/target/carrera.war n03/console/ diff --git a/carrera-prod/mysql/Dockerfile b/carrera-prod/mysql/Dockerfile new file mode 100644 index 0000000..936c660 --- /dev/null +++ b/carrera-prod/mysql/Dockerfile @@ -0,0 +1,9 @@ +FROM mysql:5.7 + +ENV MYSQL_ALLOW_EMPTY_PASSWORD yes +ENV MYSQL_DATABASE=carrera_open_source +ENV MYSQL_ROOT_PASSWORD=wawa521 + +ADD ddmq.sql /docker-entrypoint-initdb.d + +EXPOSE 3306 diff --git a/carrera-prod/mysql/ddmq.sql b/carrera-prod/mysql/ddmq.sql new file mode 100644 index 0000000..ce68735 --- /dev/null +++ b/carrera-prod/mysql/ddmq.sql @@ -0,0 +1,379 @@ +-- MySQL dump 10.13 Distrib 5.7.24, for macos10.14 (x86_64) +-- +-- Host: 127.0.0.1 Database: carrera_open_source +-- ------------------------------------------------------ +-- Server version 5.7.24 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `cluster` +-- + +DROP TABLE IF EXISTS `cluster`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `cluster` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id', + `name` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '集群名称', + `description` varchar(1024) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '描述信息', + `idc_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'idc table primarykey', + `idc` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT 'gz01' COMMENT '集群所属机房', + `remark` varchar(1024) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '备注', + `is_delete` tinyint(3) NOT NULL DEFAULT '0' COMMENT '是否删除 0:未删除 1:删除', + `create_time` datetime NOT NULL DEFAULT '1970-01-01 00:00:00' COMMENT '创建时间', + `modify_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `idx_name` (`name`,`is_delete`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='集群信息'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `cluster` +-- + +LOCK TABLES `cluster` WRITE; +/*!40000 ALTER TABLE `cluster` DISABLE KEYS */; +INSERT INTO `cluster` VALUES (1,'ddmq','open source',1,'default','default cluster',0,'2017-03-15 03:47:48','2018-12-28 12:34:03'); +/*!40000 ALTER TABLE `cluster` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `cluster_mqserver_relation` +-- + +DROP TABLE IF EXISTS `cluster_mqserver_relation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `cluster_mqserver_relation` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id', + `cluster_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '集群id', + `cluster_name` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '集群名称', + `mq_server_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'mqserver id', + `mq_server_name` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'mqserver名称', + `proxy_conf` varchar(4096) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '集群配置', + `type` tinyint(3) NOT NULL DEFAULT '0' COMMENT '集群和mqserver关联类型,0:pproxy 1:cproxy', + `is_delete` tinyint(3) NOT NULL DEFAULT '0' COMMENT '是否删除 0:未删除 1:删除', + `create_time` datetime NOT NULL DEFAULT '1970-01-01 00:00:00' COMMENT '创建时间', + `modify_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='cluster和mq关系表'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `cluster_mqserver_relation` +-- + +LOCK TABLES `cluster_mqserver_relation` WRITE; +/*!40000 ALTER TABLE `cluster_mqserver_relation` DISABLE KEYS */; +INSERT INTO `cluster_mqserver_relation` VALUES (1,1,'ddmq',1,'R_default','{\"groupPrefix\":\"carrera_rocketmq_consumer_\",\"pullBatchSize\":32,\"pollNameServerInterval\":2000,\"consumeMessageBatchMaxSize\":1,\"persistConsumerOffsetInterval\":5000,\"pullThresholdForQueue\":1000,\"consumeFromWhere\":\"CONSUME_FROM_LAST_OFFSET\",\"heartbeatBrokerInterval\":2000,\"consumeConcurrentlyMaxSpan\":2000}',1,0,'2018-07-20 11:25:58','2018-12-28 12:36:28'); +INSERT INTO `cluster_mqserver_relation` VALUES (2,1,'ddmq',1,'R_default','{\"useKafka\":false,\"warmUpConnection\":true,\"rocketmqConfigurationMap\":{\"R_default\":{\"groupPrefix\":\"carrera_rocketmq_producer_\",\"compressMsgBodyOverHowmuch\":4096,\"pollNameServerInterval\":2000,\"namesrvAddrs\":[\"127.0.0.1:9876\"],\"persistConsumerOffsetInterval\":5000,\"heartbeatBrokerInterval\":10000,\"clientCallbackExecutorThreads\":4,\"retryAnotherBrokerWhenNotStoreOK\":false,\"retryTimesWhenSendFailed\":1,\"sendMsgTimeout\":3000,\"maxMessageSize\":2097152}},\"warmUpFetchTopicRouteInfo\":true,\"rateLimit\":{\"staticMode\":false},\"thriftServer\":{\"workerQueueSize\":20000,\"backlog\":50,\"timeoutCheckerThreads\":3,\"port\":9613,\"acceptQueueSizePerThread\":100,\"selectorThreads\":8,\"maxReadBufferBytes\":5000000,\"clientTimeout\":0,\"workerThreads\":0},\"rocketmqProducers\":3,\"useRocketmq\":true,\"retryDelays\":[200,500,1000,5000,10000],\"autoBatch\":{\"maxBathBytes\":4096,\"encodeWorkerThreads\":4,\"maxBatchMessagesNumber\":32,\"doBatchThresholdBytes\":1024,\"maxContinuouslyRunningMills\":50,\"batchWaitMills\":5,\"maxEncodeWorkerForEachBroker\":1},\"kafkaProducers\":3,\"delay\":{\"chronosInnerTopicPrefix\":\"R_test_chronos_inner_\",\"innerTopicNum\":1},\"paramLength\":{\"tagLenMax\":255,\"failWhenIllegal\":true,\"keyLenMax\":255},\"tpsWarningRatio\":0.8,\"useAutoBatch\":true,\"maxTps\":3000,\"useRequestLimiter\":true,\"defaultTopicInfoConf\":{\"topics\":[]}}',0,0,'2018-07-20 11:27:03','2018-12-28 12:36:39'); +/*!40000 ALTER TABLE `cluster_mqserver_relation` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `consume_group` +-- + +DROP TABLE IF EXISTS `consume_group`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `consume_group` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id', + `group_name` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'groupname', + `service` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '成本分摊方', + `department` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '部门,;分割', + `contacters` varchar(512) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '负责rd,;分割', + `alarm_is_enable` tinyint(3) NOT NULL DEFAULT '0' COMMENT '0启用报警 1禁用报警', + `alarm_group` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '报警组信息, ;分割', + `alarm_level` tinyint(3) NOT NULL DEFAULT '2' COMMENT '报警级别,默认 二级报警,1,2,3级报警', + `alarm_msg_lag` int(11) NOT NULL DEFAULT '10000' COMMENT '消息积压报警阈值,默认积压10000条', + `alarm_delay_time` int(11) NOT NULL DEFAULT '300000' COMMENT '消息延迟报警时间,单位ms,默认5分钟', + `broadcast_consume` tinyint(3) NOT NULL DEFAULT '1' COMMENT '是否广播消费 0启用 1禁用,默认1', + `consume_mode` tinyint(3) NOT NULL DEFAULT '1' COMMENT '0同机房消费 1跨机房消费 2自定义,默认1', + `consume_mode_mapper` varchar(2048) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '自定义消费模式,map结构,key为client idc,value为cproxy idc列表', + `extra_params` varchar(2048) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '额外参数', + `config` varchar(2048) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '运维端配置参数', + `remark` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT ' group 备注', + `is_delete` tinyint(3) NOT NULL DEFAULT '0' COMMENT '是否删除 0:未删除 1:删除', + `create_time` datetime NOT NULL DEFAULT '1970-01-01 00:00:00' COMMENT '创建时间', + `modify_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `idx_groupname` (`group_name`,`is_delete`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='消费组表'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `consume_group` +-- + +LOCK TABLES `consume_group` WRITE; +/*!40000 ALTER TABLE `consume_group` DISABLE KEYS */; +/*!40000 ALTER TABLE `consume_group` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `consume_subscription` +-- + +DROP TABLE IF EXISTS `consume_subscription`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `consume_subscription` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id', + `group_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '组id', + `group_name` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '组名称', + `topic_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'topic主键id', + `topic_name` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'topic名称', + `cluster_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '集群id', + `cluster_name` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '集群名称', + `mq_server_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'mqserver id', + `mq_server_name` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'mqserver名称', + `pressure_traffic` tinyint(3) NOT NULL DEFAULT '0' COMMENT '0 否不接收压测流量,1 接收压测流量,默认0否不接收压测流量', + `max_tps` double(11,2) NOT NULL DEFAULT '1000.00' COMMENT '限流tps', + `alarm_type` tinyint(3) NOT NULL DEFAULT '0' COMMENT '报警类型:0.继承消费组配置 1.单独配置', + `alarm_is_enable` tinyint(3) NOT NULL DEFAULT '0' COMMENT '0启用报警 1禁用报警', + `alarm_level` tinyint(3) NOT NULL DEFAULT '2' COMMENT '报警级别,默认 二级报警,1,2,3级报警', + `alarm_msg_lag` int(11) NOT NULL DEFAULT '10000' COMMENT '消息积压报警阈值,默认积压10000条', + `alarm_delay_time` int(11) NOT NULL DEFAULT '300000' COMMENT '消息延迟报警时间,单位ms,默认5分钟', + `api_type` tinyint(3) NOT NULL DEFAULT '1' COMMENT '使用消息接口类型,1:highlevel 2 lowlevel,默认1', + `consume_timeout` int(11) NOT NULL DEFAULT '1000' COMMENT '消息超时时间,默认1000ms,单位ms', + `error_retry_times` int(11) NOT NULL DEFAULT '3' COMMENT '消息错误重试次数,默认3次,-1 为一直重试', + `retry_intervals` varchar(1024) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '消息重试间隔,分号分隔', + `msg_type` tinyint(3) NOT NULL DEFAULT '0' COMMENT '消息类型:1Json 2text 3二进制数据', + `enable_groovy` tinyint(3) NOT NULL DEFAULT '0' COMMENT '是否启用groovy 0 启用 1禁用', + `enable_transit` tinyint(3) NOT NULL DEFAULT '0' COMMENT '是否启用Transit 0 启用 1禁用', + `groovy` text COLLATE utf8_bin COMMENT 'groovy脚本', + `transit` text COLLATE utf8_bin COMMENT 'transit json字符串,key->val', + `enable_order` tinyint(3) NOT NULL DEFAULT '0' COMMENT '是否启用保序,0启用 1禁用', + `order_key` varchar(512) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '保序key', + `consume_type` tinyint(3) NOT NULL DEFAULT '0' COMMENT '消费类型:1SDK 2HTTP 3直写第三方组件', + `big_data_type` tinyint(3) NOT NULL DEFAULT '0' COMMENT '写入类型,0:hdfs 1:hbase 2:redis', + `big_data_config` varchar(2048) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '大数据配置内容,json格式', + `urls` varchar(2048) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'url列表,多个以分号分隔', + `http_method` tinyint(3) NOT NULL DEFAULT '0' COMMENT '0 Post 1Get', + `http_headers` varchar(1024) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'header 分号分隔,key:val;key:val', + `http_query_params` varchar(1024) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'queryParmas,分号分隔,key:val;key:val', + `msg_push_type` tinyint(3) NOT NULL DEFAULT '0' COMMENT '消息推送方式:1.放在http消息体 2.param= 3.消息体第一层打平', + `http_token` varchar(1024) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'token 校验', + `push_max_concurrency` int(11) NOT NULL DEFAULT '0' COMMENT 'http消息支持最大并发', + `actions` varchar(1024) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '消息链,根据config配置推算出actions', + `config` varchar(2048) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '运维端配置参数', + `state` tinyint(3) NOT NULL DEFAULT '0' COMMENT '消息订阅状态,0:启用 1:禁用', + `extra_params` varchar(2048) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '额外参数', + `remark` varchar(1024) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '备注', + `is_delete` tinyint(3) NOT NULL DEFAULT '0' COMMENT '是否删除 0:未删除 1:删除', + `create_time` datetime NOT NULL DEFAULT '1970-01-01 00:00:00' COMMENT '创建时间', + `modify_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + PRIMARY KEY (`id`), + KEY `idx_groupid_topicid` (`is_delete`,`group_id`,`topic_id`,`state`), + KEY `idx_clu_group_consumetype` (`is_delete`,`cluster_id`,`group_id`,`consume_type`,`state`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='消费订阅关系表'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `consume_subscription` +-- + +LOCK TABLES `consume_subscription` WRITE; +/*!40000 ALTER TABLE `consume_subscription` DISABLE KEYS */; +/*!40000 ALTER TABLE `consume_subscription` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `idc` +-- + +DROP TABLE IF EXISTS `idc`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `idc` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id', + `name` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '集群名称', + `remark` varchar(1024) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '备注', + `is_delete` tinyint(3) NOT NULL DEFAULT '0' COMMENT '是否删除 0:未删除 1:删除', + `create_time` datetime NOT NULL DEFAULT '1970-01-01 00:00:00' COMMENT '创建时间', + `modify_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `idx_name` (`name`,`is_delete`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='机房信息'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `idc` +-- + +LOCK TABLES `idc` WRITE; +/*!40000 ALTER TABLE `idc` DISABLE KEYS */; +INSERT INTO `idc` VALUES (1,'default','',0,'2018-06-22 11:08:18','2018-12-28 09:40:19'); +/*!40000 ALTER TABLE `idc` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `mq_server` +-- + +DROP TABLE IF EXISTS `mq_server`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mq_server` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id', + `name` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'mq 集群名称', + `description` varchar(1024) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '描述信息', + `addr` varchar(512) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'mq 集群地址', + `type` tinyint(3) NOT NULL DEFAULT '0' COMMENT 'mq 集群类型 0:rmq 1:kafka 2:virtual kafka', + `idc_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'idc table primarykey', + `idc` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT 'gz01' COMMENT '集群所属机房', + `is_delete` tinyint(3) NOT NULL DEFAULT '0' COMMENT '是否删除 0:未删除 1:删除', + `create_time` datetime NOT NULL DEFAULT '1970-01-01 00:00:00' COMMENT '创建时间', + `modify_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='mq 集群信息'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `mq_server` +-- + +LOCK TABLES `mq_server` WRITE; +/*!40000 ALTER TABLE `mq_server` DISABLE KEYS */; +INSERT INTO `mq_server` VALUES (1,'R_default','rocketmq','172.18.0.3:9876;172.18.0.4:9876',0,1,'default',0,'2017-04-17 14:56:17','2018-12-28 12:37:38'); +/*!40000 ALTER TABLE `mq_server` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `node` +-- + +DROP TABLE IF EXISTS `node`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `node` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id', + `cluster_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '集群id', + `model_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '机型id', + `master_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'broker主节点', + `host` varchar(128) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '机器地址 ip:port', + `node_type` tinyint(3) NOT NULL DEFAULT '0' COMMENT 'node类型, kafkabroker, rmqbroker xxxx', + `is_delete` tinyint(3) NOT NULL DEFAULT '0' COMMENT '是否删除 0:未删除 1:删除', + `create_time` datetime NOT NULL DEFAULT '1970-01-01 00:00:00' COMMENT '创建时间', + `modify_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + PRIMARY KEY (`id`), + KEY `idx_clusterid_host` (`is_delete`,`cluster_id`,`host`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='broker 信息'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `node` +-- + +LOCK TABLES `node` WRITE; +/*!40000 ALTER TABLE `node` DISABLE KEYS */; +INSERT INTO `node` VALUES (1,1,1,0,'172.18.0.3',3,0,'2018-12-28 11:29:01','2018-12-28 12:39:21'),(2,1,1,0,'172.18.0.3',4,0,'2018-12-28 11:29:05','2018-12-28 12:39:21'); +INSERT INTO `node` VALUES (3,1,1,0,'172.18.0.4',3,0,'2018-12-28 11:29:01','2018-12-28 12:39:21'),(4,1,1,0,'172.18.0.4',4,0,'2018-12-28 11:29:05','2018-12-28 12:39:21'); +INSERT INTO `node` VALUES (5,1,1,0,'172.18.0.5',3,0,'2018-12-28 11:29:01','2018-12-28 12:39:21'),(6,1,1,0,'172.18.0.5',4,0,'2018-12-28 11:29:05','2018-12-28 12:39:21'); +/*!40000 ALTER TABLE `node` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `topic` +-- + +DROP TABLE IF EXISTS `topic`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `topic` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id', + `topic_name` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'topic名称', + `topic_schema` text COLLATE utf8_bin COMMENT 'topicschema', + `service` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '成本分摊方', + `department` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '部门 一级部门 - 二级部门', + `contacters` varchar(1024) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '联系人,;分割', + `alarm_group` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '报警组信息, ;分割', + `alarm_is_enable` tinyint(3) NOT NULL DEFAULT '0' COMMENT '是否启用报警,0 启用 1禁用,默认启用', + `delay_topic` tinyint(3) NOT NULL DEFAULT '1' COMMENT '是否是延时Topic,0 延时 1非延时,默认1', + `need_audit_subinfo` tinyint(4) NOT NULL DEFAULT '1' COMMENT '是否需要审核订阅信息 0需要审核订阅信息 1不需要审核订阅信息,默认1', + `enable_schema_verify` tinyint(3) NOT NULL DEFAULT '1' COMMENT '是否启用schema校验 0启用 1禁用,默认1', + `produce_mode` tinyint(3) NOT NULL DEFAULT '0' COMMENT '0 同机房生产 1 自定义,默认0', + `produce_mode_mapper` varchar(2048) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '生产模式自定义,map结构,key为client idc,value为pproxy idc列表', + `state` tinyint(3) NOT NULL DEFAULT '0' COMMENT 'topic状态,0启用,1禁用', + `config` varchar(2048) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '运维端配置参数', + `description` varchar(1024) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT ' topic描述信息', + `extra_params` varchar(2048) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '额外参数', + `is_delete` tinyint(3) NOT NULL DEFAULT '0' COMMENT '是否删除 0:未删除 1:删除', + `create_time` datetime NOT NULL DEFAULT '1970-01-01 00:00:00' COMMENT '创建时间', + `modify_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `idx_topicname` (`topic_name`,`is_delete`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='topic信息表'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `topic` +-- + +LOCK TABLES `topic` WRITE; +/*!40000 ALTER TABLE `topic` DISABLE KEYS */; +/*!40000 ALTER TABLE `topic` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `topic_conf` +-- + +DROP TABLE IF EXISTS `topic_conf`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `topic_conf` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id', + `topic_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'topic 主键id', + `topic_name` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'topic名称', + `cluster_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '集群id', + `cluster_name` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '集群名称', + `mq_server_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'mqserver id', + `mq_server_name` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'mqserver名称', + `server_idc_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'server对应的机房id', + `server_idc_name` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'server对应的机房名称', + `client_idc` varchar(1024) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'clientidc对应的id和value', + `produce_tps` int(11) NOT NULL DEFAULT '1024' COMMENT '预估生产tps,默认1024', + `msg_avg_size` int(11) NOT NULL DEFAULT '0' COMMENT '消息平均大小,单位字节', + `msg_max_size` int(11) NOT NULL DEFAULT '0' COMMENT '消息最大大小,单位字节', + `state` tinyint(3) NOT NULL DEFAULT '0' COMMENT 'topic状态,0启用,1禁用', + `config` varchar(2048) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '运维端配置参数', + `is_delete` tinyint(3) NOT NULL DEFAULT '0' COMMENT '是否删除 0:未删除 1:删除', + `create_time` datetime NOT NULL DEFAULT '1970-01-01 00:00:00' COMMENT '创建时间', + `modify_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + PRIMARY KEY (`id`), + KEY `idx_topicid_clusterid_mqserverid` (`is_delete`,`topic_id`,`cluster_id`,`mq_server_id`), + KEY `idx_topicname` (`is_delete`,`topic_name`,`cluster_name`,`mq_server_name`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='topic集群配置表'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `topic_conf` +-- + +LOCK TABLES `topic_conf` WRITE; +/*!40000 ALTER TABLE `topic_conf` DISABLE KEYS */; +/*!40000 ALTER TABLE `topic_conf` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2018-12-29 16:54:26 diff --git a/carrera-prod/n01/Dockerfile b/carrera-prod/n01/Dockerfile new file mode 100644 index 0000000..2d41dc8 --- /dev/null +++ b/carrera-prod/n01/Dockerfile @@ -0,0 +1,57 @@ +FROM centos:7 + +## Ports +EXPOSE 9613 +EXPOSE 9713 +EXPOSE 8080 +EXPOSE 2181 + +# Env +ENV HOME_DIR /root +ENV HOME /root + +WORKDIR ${HOME_DIR} + +RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ + && echo 'Asia/Shanghai' >/etc/timezone + +RUN yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel unzip gettext nmap-ncat openssl wget telnet\ + && yum clean all -y + +RUN curl http://mirror.bit.edu.cn/apache/tomcat/tomcat-9/v9.0.24/bin/apache-tomcat-9.0.24.zip -o tomcat.zip \ + && unzip tomcat.zip \ + && mv apache-tomcat-9.0.24 tomcat \ + && rm tomcat.zip \ + && chmod +x tomcat/bin/*.sh + +RUN curl http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz -o zookeeper-3.4.10.tar.gz \ + && tar xzvf zookeeper-3.4.10.tar.gz \ + && mv zookeeper-3.4.10 zookeeper \ + && rm zookeeper-3.4.10.tar.gz \ + && cp zookeeper/conf/zoo_sample.cfg zookeeper/conf/zoo.cfg \ + && echo "dataDir=/root/zookeeper/data" >> zookeeper/conf/zoo.cfg \ + && echo "server.1=172.18.0.3:2888:3888" >> zookeeper/conf/zoo.cfg \ + && echo "server.2=172.18.0.4:2888:3888" >> zookeeper/conf/zoo.cfg \ + && echo "server.3=172.18.0.5:2888:3888" >> zookeeper/conf/zoo.cfg \ + && mkdir zookeeper/data \ + && echo '1' > zookeeper/data/myid + +RUN mkdir -p \ + /root/logs/rocketmqlogs \ + /root/chronos-storage/rocksdb \ + /root/chronos-storage/seektimestamp \ + /root/chronos-storage/rocksdb_backup \ + /root/chronos-storage/rocksdb_restore + +# copy +COPY console ${HOME_DIR}/console +COPY consumer ${HOME_DIR}/consumer +COPY producer ${HOME_DIR}/producer +COPY chronos ${HOME_DIR}/chronos +COPY broker ${HOME_DIR}/broker +COPY namesvr ${HOME_DIR}/namesvr +COPY start.sh ${HOME_DIR}/start.sh +COPY stop.sh ${HOME_DIR}/stop.sh + +# cmd +CMD bash -C '/root/start.sh';'bash' diff --git a/carrera-prod/n01/broker/LICENSE b/carrera-prod/n01/broker/LICENSE new file mode 100644 index 0000000..3726172 --- /dev/null +++ b/carrera-prod/n01/broker/LICENSE @@ -0,0 +1,334 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (properties) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +------ +This product has a bundle logback, which is available under the EPL v1.0 License. +The source code of logback can be found at https://github.com/qos-ch/logback. + +Logback LICENSE +--------------- + +Logback: the reliable, generic, fast and flexible logging framework. +Copyright (C) 1999-2015, QOS.ch. All rights reserved. + +This program and the accompanying materials are dual-licensed under +either the terms of the Eclipse Public License v1.0 as published by +the Eclipse Foundation + + or (per the licensee's choosing) + +under the terms of the GNU Lesser General Public License version 2.1 +as published by the Free Software Foundation. + +------ +This product has a bundle slf4j, which is available under the MIT License. +The source code of slf4j can be found at https://github.com/qos-ch/slf4j. + + Copyright (c) 2004-2017 QOS.ch + All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +------ +This product has a bundle fastjson, which is available under the ASL2 License. +The source code of fastjson can be found at https://github.com/alibaba/fastjson. + + Copyright 1999-2016 Alibaba Group Holding Ltd. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +------ +This product has a bundle javassist, which is available under the ASL2 License. +The source code of javassist can be found at https://github.com/jboss-javassist/javassist. + + Copyright (C) 1999- by Shigeru Chiba, All rights reserved. + + Javassist (JAVA programming ASSISTant) makes Java bytecode manipulation simple. + It is a class library for editing bytecodes in Java; it enables Java programs to define a new class + at runtime and to modify a class file when the JVM loads it. Unlike other similar bytecode editors, + Javassist provides two levels of API: source level and bytecode level. If the users use the source- level API, + they can edit a class file without knowledge of the specifications of the Java bytecode. + The whole API is designed with only the vocabulary of the Java language. + You can even specify inserted bytecode in the form of source text; Javassist compiles it on the fly. + On the other hand, the bytecode-level API allows the users to directly edit a class file as other editors. + + This software is distributed under the Mozilla Public License Version 1.1, + the GNU Lesser General Public License Version 2.1 or later, or the Apache License Version 2.0. + +------ +This product has a bundle jna, which is available under the ASL2 License. +The source code of jna can be found at https://github.com/java-native-access/jna. + + This copy of JNA is licensed under the + Apache (Software) License, version 2.0 ("the License"). + See the License for details about distribution rights, and the + specific rights regarding derivate works. + + You may obtain a copy of the License at: + + http://www.apache.org/licenses/ + + A copy is also included in the downloadable source code package + containing JNA, in file "AL2.0", under the same directory + as this file. +------ +This product has a bundle guava, which is available under the ASL2 License. +The source code of guava can be found at https://github.com/google/guava. + + Copyright (C) 2007 The Guava authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +------ +This product has a bundle OpenMessaging, which is available under the ASL2 License. +The source code of OpenMessaging can be found at https://github.com/openmessaging/openmessaging. + + Copyright (C) 2017 The OpenMessaging authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/carrera-prod/n01/broker/NOTICE b/carrera-prod/n01/broker/NOTICE new file mode 100644 index 0000000..c91dc22 --- /dev/null +++ b/carrera-prod/n01/broker/NOTICE @@ -0,0 +1,36 @@ +Apache RocketMQ +Copyright 2016-2017 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +------ +This product has a bundle netty: + The Netty Project + ================= + +Please visit the Netty web site for more information: + + * http://netty.io/ + +Copyright 2014 The Netty Project + +The Netty Project licenses this file to you under the Apache License, +version 2.0 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations +under the License. + +Also, please refer to each LICENSE..txt file, which is located in +the 'license' directory of the distribution file, for the license terms of the +components that this product depends on. + +------ +This product has a bundle commons-lang, which includes software from the Spring Framework, +under the Apache License 2.0 (see: StringUtils.containsWhitespace()) \ No newline at end of file diff --git a/carrera-prod/n01/broker/bin/README.md b/carrera-prod/n01/broker/bin/README.md new file mode 100755 index 0000000..efbb67d --- /dev/null +++ b/carrera-prod/n01/broker/bin/README.md @@ -0,0 +1,29 @@ +### Operating system tuning +Before deploying broker servers, it's highly recommended to run **os.sh**, which is to optimize your operating system for better performance. + +## Notice +### os.sh should be executed only once with root permission. +### os.sh parameter settings are for reference purpose only. You can tune them according to your target host configurations. + + +### Start broker +* Unix platform + + `nohup sh mqbroker &` + +### Shutdown broker + sh mqshutdown broker + +### Start Nameserver +* Unix platform + + `nohup sh mqnamesrv &` + +### Shutdown Nameserver + sh mqshutdown namesrv + +### Update or create Topic + sh mqadmin updateTopic -b 127.0.0.1:10911 -t TopicA + +### Update or create subscription group + sh mqadmin updateSubGroup -b 127.0.0.1:10911 -g SubGroupA \ No newline at end of file diff --git a/carrera-prod/n01/broker/bin/cachedog.sh b/carrera-prod/n01/broker/bin/cachedog.sh new file mode 100755 index 0000000..9329fdb --- /dev/null +++ b/carrera-prod/n01/broker/bin/cachedog.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=$PATH:/sbin + +while true; do + nr_free_pages=`fgrep -A 10 Normal /proc/zoneinfo |grep nr_free_pages |awk -F ' ' '{print $2}'` + high=`fgrep -A 10 Normal /proc/zoneinfo |grep high |awk -F ' ' '{print $2}'` + + NOW_DATE=`date +%D` + NOW_TIME=`date +%T` + + if [ ${nr_free_pages} -le ${high} ]; then + sysctl -w vm.drop_caches=3 + nr_free_pages_new=`fgrep -A 10 Normal /proc/zoneinfo |grep nr_free_pages |awk -F ' ' '{print $2}'` + + printf "%s %s [CLEAN] nr_free_pages < high, clean cache. nr_free_pages=%s ====> nr_free_pages=%s\n" "${NOW_DATE}" "${NOW_TIME}" ${nr_free_pages} ${nr_free_pages_new} + + sysctl -w vm.drop_caches=1 + echo + echo + echo + else + printf "%s %s [NOTHING] nr_free_pages=%s high=%s\n" "${NOW_DATE}" "${NOW_TIME}" ${nr_free_pages} ${high} + fi + + sleep 1 +done diff --git a/carrera-prod/n01/broker/bin/cleancache.sh b/carrera-prod/n01/broker/bin/cleancache.sh new file mode 100755 index 0000000..9c6e9ab --- /dev/null +++ b/carrera-prod/n01/broker/bin/cleancache.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=$PATH:/sbin + +sysctl -w vm.drop_caches=3 diff --git a/carrera-prod/n01/broker/bin/cleancache.v1.sh b/carrera-prod/n01/broker/bin/cleancache.v1.sh new file mode 100755 index 0000000..b334841 --- /dev/null +++ b/carrera-prod/n01/broker/bin/cleancache.v1.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=$PATH:/sbin + +# +# GB +# +function changeFreeCache() +{ + EXTRA=$1 + MIN=$2 + sysctl -w vm.extra_free_kbytes=${EXTRA}000000 + sysctl -w vm.min_free_kbytes=${MIN}000000 +} + + +if [ $# -ne 1 ] +then + echo "Usage: $0 freecache(GB)" + echo "Example: $0 15" + exit +fi + +changeFreeCache 3 $1 +changeFreeCache 3 1 diff --git a/carrera-prod/n01/broker/bin/mqadmin b/carrera-prod/n01/broker/bin/mqadmin new file mode 100755 index 0000000..cd0253b --- /dev/null +++ b/carrera-prod/n01/broker/bin/mqadmin @@ -0,0 +1,45 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +sh ${ROCKETMQ_HOME}/bin/tools.sh org.apache.rocketmq.tools.command.MQAdminStartup $@ diff --git a/carrera-prod/n01/broker/bin/mqadmin.cmd b/carrera-prod/n01/broker/bin/mqadmin.cmd new file mode 100755 index 0000000..4e061f0 --- /dev/null +++ b/carrera-prod/n01/broker/bin/mqadmin.cmd @@ -0,0 +1,18 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%ROCKETMQ_HOME%\bin\tools.cmd" echo Please set the ROCKETMQ_HOME variable in your environment! & EXIT /B 1 +call "%ROCKETMQ_HOME%\bin\tools.cmd" org.apache.rocketmq.tools.command.MQAdminStartup %* \ No newline at end of file diff --git a/carrera-prod/n01/broker/bin/mqadmin.xml b/carrera-prod/n01/broker/bin/mqadmin.xml new file mode 100755 index 0000000..0f07da4 --- /dev/null +++ b/carrera-prod/n01/broker/bin/mqadmin.xml @@ -0,0 +1,43 @@ + + + + false + + ${JAVA_HOME} + + server + + org.apache.rocketmq.tools.command.MQAdminStartup + + + ${cpd}/../lib + ${cpd}/.. + + + + + + + <-Xms512m> + <-Xmx1g> + <-XX:NewSize>256M + <-XX:MaxNewSize>512M + <-XX:PermSize>128M + <-XX:MaxPermSize>128M + + diff --git a/carrera-prod/n01/broker/bin/mqbroker b/carrera-prod/n01/broker/bin/mqbroker new file mode 100755 index 0000000..6a79c39 --- /dev/null +++ b/carrera-prod/n01/broker/bin/mqbroker @@ -0,0 +1,45 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +sh ${ROCKETMQ_HOME}/bin/runbroker.sh org.apache.rocketmq.broker.BrokerStartup $@ diff --git a/carrera-prod/n01/broker/bin/mqbroker.cmd b/carrera-prod/n01/broker/bin/mqbroker.cmd new file mode 100755 index 0000000..3efb475 --- /dev/null +++ b/carrera-prod/n01/broker/bin/mqbroker.cmd @@ -0,0 +1,23 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%ROCKETMQ_HOME%\bin\runbroker.cmd" echo Please set the ROCKETMQ_HOME variable in your environment! & EXIT /B 1 + +call "%ROCKETMQ_HOME%\bin\runbroker.cmd" org.apache.rocketmq.broker.BrokerStartup %* + +IF %ERRORLEVEL% EQU 0 ( + ECHO "Broker starts OK" +) \ No newline at end of file diff --git a/carrera-prod/n01/broker/bin/mqbroker.numanode0 b/carrera-prod/n01/broker/bin/mqbroker.numanode0 new file mode 100755 index 0000000..b7486a7 --- /dev/null +++ b/carrera-prod/n01/broker/bin/mqbroker.numanode0 @@ -0,0 +1,47 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +export RMQ_NUMA_NODE=0 + +sh ${ROCKETMQ_HOME}/bin/mqbroker $@ diff --git a/carrera-prod/n01/broker/bin/mqbroker.numanode1 b/carrera-prod/n01/broker/bin/mqbroker.numanode1 new file mode 100755 index 0000000..c301fed --- /dev/null +++ b/carrera-prod/n01/broker/bin/mqbroker.numanode1 @@ -0,0 +1,47 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +export RMQ_NUMA_NODE=1 + +sh ${ROCKETMQ_HOME}/bin/mqbroker $@ diff --git a/carrera-prod/n01/broker/bin/mqbroker.numanode2 b/carrera-prod/n01/broker/bin/mqbroker.numanode2 new file mode 100755 index 0000000..ea95304 --- /dev/null +++ b/carrera-prod/n01/broker/bin/mqbroker.numanode2 @@ -0,0 +1,47 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +export RMQ_NUMA_NODE=2 + +sh ${ROCKETMQ_HOME}/bin/mqbroker $@ diff --git a/carrera-prod/n01/broker/bin/mqbroker.numanode3 b/carrera-prod/n01/broker/bin/mqbroker.numanode3 new file mode 100755 index 0000000..25d3d1d --- /dev/null +++ b/carrera-prod/n01/broker/bin/mqbroker.numanode3 @@ -0,0 +1,47 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +export RMQ_NUMA_NODE=3 + +sh ${ROCKETMQ_HOME}/bin/mqbroker $@ diff --git a/carrera-prod/n01/broker/bin/mqbroker.xml b/carrera-prod/n01/broker/bin/mqbroker.xml new file mode 100755 index 0000000..3043cc0 --- /dev/null +++ b/carrera-prod/n01/broker/bin/mqbroker.xml @@ -0,0 +1,45 @@ + + + + false + + ${JAVA_HOME} + + server + + org.apache.rocketmq.broker.BrokerStartup + + + ${cpd}/../lib + ${cpd}/.. + + + + + + + <-Xms512m> + + <-Xmx1g> + +<-XX:NewSize>256M +<-XX:MaxNewSize>512M +<-XX:PermSize>128M +<-XX:MaxPermSize>128M + + diff --git a/carrera-prod/n01/broker/bin/mqfiltersrv b/carrera-prod/n01/broker/bin/mqfiltersrv new file mode 100755 index 0000000..2fd0cbe --- /dev/null +++ b/carrera-prod/n01/broker/bin/mqfiltersrv @@ -0,0 +1,45 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +sh ${ROCKETMQ_HOME}/bin/runserver.sh org.apache.rocketmq.filtersrv.FiltersrvStartup $@ diff --git a/carrera-prod/n01/broker/bin/mqfiltersrv.cmd b/carrera-prod/n01/broker/bin/mqfiltersrv.cmd new file mode 100755 index 0000000..0503026 --- /dev/null +++ b/carrera-prod/n01/broker/bin/mqfiltersrv.cmd @@ -0,0 +1,23 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%ROCKETMQ_HOME%\bin\runbroker.cmd" echo Please set the ROCKETMQ_HOME variable in your environment! & EXIT /B 1 + +call "%ROCKETMQ_HOME%\bin\runserver.cmd" org.apache.rocketmq.filtersrv.FiltersrvStartup %* + +IF %ERRORLEVEL% EQU 0 ( + ECHO "Filtersrv starts OK" +) \ No newline at end of file diff --git a/carrera-prod/n01/broker/bin/mqfiltersrv.xml b/carrera-prod/n01/broker/bin/mqfiltersrv.xml new file mode 100755 index 0000000..dc36a8d --- /dev/null +++ b/carrera-prod/n01/broker/bin/mqfiltersrv.xml @@ -0,0 +1,45 @@ + + + + false + + ${JAVA_HOME} + + server + + org.apache.rocketmq.filtersrv.FiltersrvStartup + + + ${cpd}/../lib + ${cpd}/.. + + + + + + + <-Xms512m> + + <-Xmx1g> + +<-XX:NewSize>256M +<-XX:MaxNewSize>512M +<-XX:PermSize>128M +<-XX:MaxPermSize>128M + + diff --git a/carrera-prod/n01/broker/bin/mqnamesrv b/carrera-prod/n01/broker/bin/mqnamesrv new file mode 100755 index 0000000..c1e70bd --- /dev/null +++ b/carrera-prod/n01/broker/bin/mqnamesrv @@ -0,0 +1,45 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +sh ${ROCKETMQ_HOME}/bin/runserver.sh org.apache.rocketmq.namesrv.NamesrvStartup $@ diff --git a/carrera-prod/n01/broker/bin/mqnamesrv.cmd b/carrera-prod/n01/broker/bin/mqnamesrv.cmd new file mode 100755 index 0000000..2828bdc --- /dev/null +++ b/carrera-prod/n01/broker/bin/mqnamesrv.cmd @@ -0,0 +1,23 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%ROCKETMQ_HOME%\bin\runserver.cmd" echo Please set the ROCKETMQ_HOME variable in your environment! & EXIT /B 1 + +call "%ROCKETMQ_HOME%\bin\runserver.cmd" org.apache.rocketmq.namesrv.NamesrvStartup %* + +IF %ERRORLEVEL% EQU 0 ( + ECHO "Namesrv starts OK" +) \ No newline at end of file diff --git a/carrera-prod/n01/broker/bin/mqnamesrv.xml b/carrera-prod/n01/broker/bin/mqnamesrv.xml new file mode 100755 index 0000000..1f050d1 --- /dev/null +++ b/carrera-prod/n01/broker/bin/mqnamesrv.xml @@ -0,0 +1,45 @@ + + + + false + + ${JAVA_HOME} + + server + + org.apache.rocketmq.namesrv.NamesrvStartup + + + ${cpd}/../lib + ${cpd}/.. + + + + + + + <-Xms512m> + + <-Xmx1g> + +<-XX:NewSize>256M +<-XX:MaxNewSize>512M +<-XX:PermSize>128M +<-XX:MaxPermSize>128M + + diff --git a/carrera-prod/n01/broker/bin/mqshutdown b/carrera-prod/n01/broker/bin/mqshutdown new file mode 100755 index 0000000..d2d51fc --- /dev/null +++ b/carrera-prod/n01/broker/bin/mqshutdown @@ -0,0 +1,49 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +case $1 in + broker) + + pid=`ps ax | grep -i 'org.apache.rocketmq.broker.BrokerStartup' |grep java | grep -v grep | awk '{print $1}'` + if [ -z "$pid" ] ; then + echo "No mqbroker running." + exit -1; + fi + + echo "The mqbroker(${pid}) is running..." + + kill ${pid} + + echo "Send shutdown request to mqbroker(${pid}) OK" + ;; + namesrv) + + pid=`ps ax | grep -i 'org.apache.rocketmq.namesrv.NamesrvStartup' |grep java | grep -v grep | awk '{print $1}'` + if [ -z "$pid" ] ; then + echo "No mqnamesrv running." + exit -1; + fi + + echo "The mqnamesrv(${pid}) is running..." + + kill ${pid} + + echo "Send shutdown request to mqnamesrv(${pid}) OK" + ;; + *) + echo "Useage: mqshutdown broker | namesrv" +esac diff --git a/carrera-prod/n01/broker/bin/mqshutdown.cmd b/carrera-prod/n01/broker/bin/mqshutdown.cmd new file mode 100755 index 0000000..50af026 --- /dev/null +++ b/carrera-prod/n01/broker/bin/mqshutdown.cmd @@ -0,0 +1,35 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%JAVA_HOME%\bin\jps.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! & EXIT /B 1 + +setlocal + +set "PATH=%JAVA_HOME%\bin;%PATH%" + +if /I "%1" == "broker" ( + echo killing broker + for /f "tokens=1" %%i in ('jps -m ^| find "BrokerStartup"') do ( taskkill /F /PID %%i ) + echo Done! +) else if /I "%1" == "namesrv" ( + echo killing name server + + for /f "tokens=1" %%i in ('jps -m ^| find "NamesrvStartup"') do ( taskkill /F /PID %%i ) + + echo Done! +) else ( + echo Unknown role to kill, please specify broker or namesrv +) \ No newline at end of file diff --git a/carrera-prod/n01/broker/bin/os.sh b/carrera-prod/n01/broker/bin/os.sh new file mode 100755 index 0000000..cb5cf05 --- /dev/null +++ b/carrera-prod/n01/broker/bin/os.sh @@ -0,0 +1,67 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=$PATH:/sbin + +HOME="/home/xiaoju" +if [ -d ${HOME}/tmpfs ] ; then + echo "tmpfs exist, do nothing." +else + ln -s /dev/shm ${HOME}/tmpfs + echo "create tmpfs ok" +fi + +# sudo sysctl -w vm.extra_free_kbytes=2000000 +# sudo sysctl -w vm.min_free_kbytes=1000000 +sudo sysctl -w vm.overcommit_memory=1 +sudo sysctl -w vm.drop_caches=1 +sudo sysctl -w vm.zone_reclaim_mode=0 +sudo sysctl -w vm.max_map_count=655360 +sudo sysctl -w vm.dirty_background_ratio=50 +sudo sysctl -w vm.dirty_ratio=50 +sudo sysctl -w vm.dirty_writeback_centisecs=360000 +sudo sysctl -w vm.page-cluster=3 +sudo sysctl -w vm.swappiness=1 + +echo 'ulimit -n 655350' >> /etc/profile +echo '* hard nofile 655350' >> /etc/security/limits.conf + +echo '* hard memlock unlimited' >> /etc/security/limits.conf +echo '* soft memlock unlimited' >> /etc/security/limits.conf + +DISK=`df -k | sort -n -r -k 2 | awk -F/ 'NR==1 {gsub(/[0-9].*/,"",$3); print $3}'` +[ "$DISK" = 'cciss' ] && DISK='cciss!c0d0' +echo 'deadline' > /sys/block/${DISK}/queue/scheduler + + +echo "---------------------------------------------------------------" +sysctl vm.extra_free_kbytes +sysctl vm.min_free_kbytes +sysctl vm.overcommit_memory +sysctl vm.drop_caches +sysctl vm.zone_reclaim_mode +sysctl vm.max_map_count +sysctl vm.dirty_background_ratio +sysctl vm.dirty_ratio +sysctl vm.dirty_writeback_centisecs +sysctl vm.page-cluster +sysctl vm.swappiness + +#su - admin -c 'ulimit -n' +ulimit -n +cat /sys/block/$DISK/queue/scheduler + diff --git a/carrera-prod/n01/broker/bin/play.cmd b/carrera-prod/n01/broker/bin/play.cmd new file mode 100755 index 0000000..f1737d5 --- /dev/null +++ b/carrera-prod/n01/broker/bin/play.cmd @@ -0,0 +1,30 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +START /B mqnamesrv > ns.log 2>&1 +IF %ERRORLEVEL% NEQ 0 ( + echo "Failed to start name server. Please check ns.log" + EXIT /B 1 +) + +START /B mqbroker -n localhost:9876 > bk.log 2>&1 + +IF %ERRORLEVEL% NEQ 0 ( + ECHO "Failed to start broker. Please check bk.log" + EXIT /B 1 +) + +echo "Start Name Server and Broker Successfully." \ No newline at end of file diff --git a/carrera-prod/n01/broker/bin/play.sh b/carrera-prod/n01/broker/bin/play.sh new file mode 100755 index 0000000..359d18d --- /dev/null +++ b/carrera-prod/n01/broker/bin/play.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Name Server +# +nohup sh mqnamesrv > ns.log 2>&1 & + +# +# Service Addr +# +ADDR=`hostname -i`:9876 + +# +# Broker +# +nohup sh mqbroker -n ${ADDR} > bk.log 2>&1 & + +echo "Start Name Server and Broker Successfully, ${ADDR}" diff --git a/carrera-prod/n01/broker/bin/runbroker b/carrera-prod/n01/broker/bin/runbroker new file mode 100755 index 0000000..538f8e1 --- /dev/null +++ b/carrera-prod/n01/broker/bin/runbroker @@ -0,0 +1,15 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. diff --git a/carrera-prod/n01/broker/bin/runbroker.cmd b/carrera-prod/n01/broker/bin/runbroker.cmd new file mode 100755 index 0000000..eab7e30 --- /dev/null +++ b/carrera-prod/n01/broker/bin/runbroker.cmd @@ -0,0 +1,42 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%JAVA_HOME%\bin\java.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! & EXIT /B 1 +set "JAVA=%JAVA_HOME%\bin\java.exe" + +setlocal + +set BASE_DIR=%~dp0 +set BASE_DIR=%BASE_DIR:~0,-1% +for %%d in (%BASE_DIR%) do set BASE_DIR=%%~dpd + +set CLASSPATH=.;%BASE_DIR%conf;%CLASSPATH% + +rem =========================================================================================== +rem JVM Configuration +rem =========================================================================================== +set "JAVA_OPT=%JAVA_OPT% -server -Xms2g -Xmx2g -Xmn1g" +set "JAVA_OPT=%JAVA_OPT% -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0 -XX:SurvivorRatio=8" +set "JAVA_OPT=%JAVA_OPT% -verbose:gc -Xloggc:%USERPROFILE%\mq_gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintAdaptiveSizePolicy" +set "JAVA_OPT=%JAVA_OPT% -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=30m" +set "JAVA_OPT=%JAVA_OPT% -XX:-OmitStackTraceInFastThrow" +set "JAVA_OPT=%JAVA_OPT% -XX:+AlwaysPreTouch" +set "JAVA_OPT=%JAVA_OPT% -XX:MaxDirectMemorySize=15g" +set "JAVA_OPT=%JAVA_OPT% -XX:-UseLargePages -XX:-UseBiasedLocking" +set "JAVA_OPT=%JAVA_OPT% -Djava.ext.dirs=%BASE_DIR%lib" +set "JAVA_OPT=%JAVA_OPT% -cp %CLASSPATH%" + +"%JAVA%" %JAVA_OPT% %* \ No newline at end of file diff --git a/carrera-prod/n01/broker/bin/runbroker.sh b/carrera-prod/n01/broker/bin/runbroker.sh new file mode 100755 index 0000000..26c6896 --- /dev/null +++ b/carrera-prod/n01/broker/bin/runbroker.sh @@ -0,0 +1,61 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#=========================================================================================== +# Java Environment Setting +#=========================================================================================== +error_exit () +{ + echo "ERROR: $1 !!" + exit 1 +} + +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java +[ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)!" + +export JAVA_HOME +export JAVA="$JAVA_HOME/bin/java" +export BASE_DIR=$(dirname $0)/.. +export CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH} + +#=========================================================================================== +# JVM Configuration +#=========================================================================================== +JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m -Xmn256m" +JAVA_OPT="${JAVA_OPT} -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0 -XX:SurvivorRatio=8" +JAVA_OPT="${JAVA_OPT} -verbose:gc -Xloggc:/dev/shm/mq_gc_%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintAdaptiveSizePolicy" +JAVA_OPT="${JAVA_OPT} -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=30m" +JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow" +JAVA_OPT="${JAVA_OPT} -XX:+AlwaysPreTouch" +JAVA_OPT="${JAVA_OPT} -XX:MaxDirectMemorySize=256m" +JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages -XX:-UseBiasedLocking" +JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${BASE_DIR}/lib" +JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}" +JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}" + +numactl --interleave=all pwd > /dev/null 2>&1 +if [ $? -eq 0 ] +then + if [ -z "$RMQ_NUMA_NODE" ] ; then + numactl --interleave=all $JAVA ${JAVA_OPT} $@ + else + numactl --cpunodebind=$RMQ_NUMA_NODE --membind=$RMQ_NUMA_NODE $JAVA ${JAVA_OPT} $@ + fi +else + $JAVA ${JAVA_OPT} $@ +fi diff --git a/carrera-prod/n01/broker/bin/runserver.cmd b/carrera-prod/n01/broker/bin/runserver.cmd new file mode 100755 index 0000000..48e32bf --- /dev/null +++ b/carrera-prod/n01/broker/bin/runserver.cmd @@ -0,0 +1,37 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + + +if not exist "%JAVA_HOME%\bin\java.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! & EXIT /B 1 +set "JAVA=%JAVA_HOME%\bin\java.exe" + +setlocal + +set BASE_DIR=%~dp0 +set BASE_DIR=%BASE_DIR:~0,-1% +for %%d in (%BASE_DIR%) do set BASE_DIR=%%~dpd + +set CLASSPATH=.;%BASE_DIR%conf;%CLASSPATH% + +set "JAVA_OPT=%JAVA_OPT% -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m" +set "JAVA_OPT=%JAVA_OPT% -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 -XX:-UseParNewGC" +set "JAVA_OPT=%JAVA_OPT% -verbose:gc -Xloggc:"%USERPROFILE%\rmq_srv_gc.log" -XX:+PrintGCDetails" +set "JAVA_OPT=%JAVA_OPT% -XX:-OmitStackTraceInFastThrow" +set "JAVA_OPT=%JAVA_OPT% -XX:-UseLargePages" +set "JAVA_OPT=%JAVA_OPT% -Djava.ext.dirs=%BASE_DIR%lib" +set "JAVA_OPT=%JAVA_OPT% -cp "%CLASSPATH%"" + +"%JAVA%" %JAVA_OPT% %* \ No newline at end of file diff --git a/carrera-prod/n01/broker/bin/runserver.sh b/carrera-prod/n01/broker/bin/runserver.sh new file mode 100755 index 0000000..297d206 --- /dev/null +++ b/carrera-prod/n01/broker/bin/runserver.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#=========================================================================================== +# Java Environment Setting +#=========================================================================================== +error_exit () +{ + echo "ERROR: $1 !!" + exit 1 +} + +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java +[ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)!" + +export JAVA_HOME +export JAVA="$JAVA_HOME/bin/java" +export BASE_DIR=$(dirname $0)/.. +export CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH} + +#=========================================================================================== +# JVM Configuration +#=========================================================================================== +JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m" +JAVA_OPT="${JAVA_OPT} -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 -XX:-UseParNewGC" +JAVA_OPT="${JAVA_OPT} -verbose:gc -Xloggc:/dev/shm/rmq_srv_gc.log -XX:+PrintGCDetails" +JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow" +JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages" +JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${BASE_DIR}/lib" +#JAVA_OPT="${JAVA_OPT} -Xdebug -Xrunjdwp:transport=dt_socket,address=9555,server=y,suspend=n" +JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}" +JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}" + +$JAVA ${JAVA_OPT} $@ diff --git a/carrera-prod/n01/broker/bin/setcache.sh b/carrera-prod/n01/broker/bin/setcache.sh new file mode 100755 index 0000000..27633f3 --- /dev/null +++ b/carrera-prod/n01/broker/bin/setcache.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=$PATH:/sbin + +# +# GB +# +function changeFreeCache() +{ + EXTRA=$1 + MIN=$2 + sysctl -w vm.extra_free_kbytes=${EXTRA}000000 + sysctl -w vm.min_free_kbytes=${MIN}000000 + sysctl -w vm.swappiness=0 +} + + +if [ $# -ne 2 ] +then + echo "Usage: $0 extra_free_kbytes(GB) min_free_kbytes(GB)" + echo "Example: $0 3 1" + exit +fi + +changeFreeCache $1 $2 diff --git a/carrera-prod/n01/broker/bin/startfsrv.sh b/carrera-prod/n01/broker/bin/startfsrv.sh new file mode 100755 index 0000000..f7ba188 --- /dev/null +++ b/carrera-prod/n01/broker/bin/startfsrv.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +nohup sh ${ROCKETMQ_HOME}/bin/runserver.sh org.apache.rocketmq.filtersrv.FiltersrvStartup $@ & diff --git a/carrera-prod/n01/broker/bin/tools.cmd b/carrera-prod/n01/broker/bin/tools.cmd new file mode 100755 index 0000000..28ce765 --- /dev/null +++ b/carrera-prod/n01/broker/bin/tools.cmd @@ -0,0 +1,35 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%JAVA_HOME%\bin\java.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! & EXIT /B 1 + +set "JAVA=%JAVA_HOME%\bin\java.exe" + +setlocal +set BASE_DIR=%~dp0 +set BASE_DIR=%BASE_DIR:~0,-1% +for %%d in (%BASE_DIR%) do set BASE_DIR=%%~dpd + +set CLASSPATH=.;%BASE_DIR%conf;%CLASSPATH% + +rem =========================================================================================== +rem JVM Configuration +rem =========================================================================================== +set "JAVA_OPT=%JAVA_OPT% -server -Xms1g -Xmx1g -Xmn256m -XX:PermSize=128m -XX:MaxPermSize=128m" +set "JAVA_OPT=%JAVA_OPT% -Djava.ext.dirs="%BASE_DIR%\lib";"%JAVA_HOME%\jre\lib\ext"" +set "JAVA_OPT=%JAVA_OPT% -cp "%CLASSPATH%"" + +"%JAVA%" %JAVA_OPT% %* \ No newline at end of file diff --git a/carrera-prod/n01/broker/bin/tools.sh b/carrera-prod/n01/broker/bin/tools.sh new file mode 100755 index 0000000..e0c840c --- /dev/null +++ b/carrera-prod/n01/broker/bin/tools.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#=========================================================================================== +# Java Environment Setting +#=========================================================================================== +error_exit () +{ + echo "ERROR: $1 !!" + exit 1 +} + +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java +[ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)!" + +export JAVA_HOME +export JAVA="$JAVA_HOME/bin/java" +export BASE_DIR=$(dirname $0)/.. +export CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH} + +#=========================================================================================== +# JVM Configuration +#=========================================================================================== +JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn256m" +JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${BASE_DIR}/lib:${JAVA_HOME}/jre/lib/ext" +JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}" + +$JAVA ${JAVA_OPT} $@ diff --git a/carrera-prod/n01/broker/conf/2m-2s-async/broker-a.properties b/carrera-prod/n01/broker/conf/2m-2s-async/broker-a.properties new file mode 100644 index 0000000..f74949e --- /dev/null +++ b/carrera-prod/n01/broker/conf/2m-2s-async/broker-a.properties @@ -0,0 +1,87 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +brokerClusterName=DefaultCluster +brokerName=broker-a +brokerId=0 +brokerRole=ASYNC_MASTER +flushDiskType=ASYNC_FLUSH +# +# Broker 对外服务的监听端口 +# +listenPort=10911 +# +# nameserver 地址,分号分割 +# +namesrvAddr=172.18.0.3:9876;172.18.0.4:9876 +# +# brokerIP1 +# +brokerIP1=172.18.0.3 +# +# 在发送消息时,自动创建服务器不存在的topic,默认创建的队列数 +# +defaultTopicQueueNums=4 +# +# 是否允许 Broker 自动创建Topic,建议线下开启,线上关闭 +# +autoCreateTopicEnable=false +# +# 是否允许 Broker 自动创建订阅组,建议线下开启,线上关闭 +# +autoCreateSubscriptionGroup=true +# +# store存储位置 +# +storePathRootDir=/root/rocketmq/broker-a/store +storePathCommitLog=/root/rocketmq/broker-a/store/commitlog +# +# 消费队列存储路径存储路径 +# +storePathConsumerQueue=/root/rocketmq/broker-a/store/consumequeue +# +# 消息索引存储路径 +# +storePathIndex=/root/rocketmq/broker-a/store/index +# +# checkpoint 文件存储路径 +# +storeCheckpoint=/root/rocketmq/broker-a/store/checkpoint +# +# abort 文件存储路径 +# +abortFile=/root/rocketmq/broker-a/store/abort +# +# 删除文件时间点,默认凌晨 4点 +# +deleteWhen=04 +# +# 文件保留时间,默认 48 小时 +# +fileReservedTime=120 +# +# commitLog每个文件的大小默认1G +# +mapedFileSizeCommitLog=1073741824 +# +# ConsumeQueue每个文件默认存30W条,根据业务情况调整 +# +mapedFileSizeConsumeQueue=300000 +# +#destroyMapedFileIntervalForcibly=120000 +#redeleteHangedFileInterval=120000 +# +# 检测物理文件磁盘空间 +# +#diskMaxUsedSpaceRatio=88 diff --git a/carrera-prod/n01/broker/conf/2m-2s-async/broker-b-s.properties b/carrera-prod/n01/broker/conf/2m-2s-async/broker-b-s.properties new file mode 100644 index 0000000..1c88d80 --- /dev/null +++ b/carrera-prod/n01/broker/conf/2m-2s-async/broker-b-s.properties @@ -0,0 +1,87 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +brokerClusterName=DefaultCluster +brokerName=broker-b +brokerId=1 +brokerRole=SLAVE +flushDiskType=ASYNC_FLUSH +# +# broker 对外服务的监听端口 +# +listenPort=10921 +# +# nameserver 地址,分号分割 +# +namesrvAddr=172.18.0.3:9876;172.18.0.4:9876 +# +# brokerIP1 +# +brokerIP1=172.18.0.3 +# +# 在发送消息时,自动创建服务器不存在的topic,默认创建的队列数 +# +defaultTopicQueueNums=4 +# +# 是否允许 Broker 自动创建Topic,建议线下开启,线上关闭 +# +autoCreateTopicEnable=false +# +# 是否允许 Broker 自动创建订阅组,建议线下开启,线上关闭 +# +autoCreateSubscriptionGroup=true +# +# store存储位置 +# +storePathRootDir=/root/rocketmq/broker-b-s/store +storePathCommitLog=/root/rocketmq/broker-b-s/store/commitlog +# +# 消费队列存储路径存储路径 +# +storePathConsumerQueue=/root/rocketmq/broker-b-s/store/consumequeue +# +# 消息索引存储路径 +# +storePathIndex=/root/rocketmq/broker-b-s/store/index +# +# checkpoint 文件存储路径 +# +storeCheckpoint=/root/rocketmq/broker-b-s/store/checkpoint +# +# abort 文件存储路径 +# +abortFile=/root/rocketmq/broker-b-s/store/abort +# +# 删除文件时间点,默认凌晨 4点 +# +deleteWhen=04 +# +# 文件保留时间,默认 48 小时 +# +fileReservedTime=120 +# +# commitLog每个文件的大小默认1G +# +mapedFileSizeCommitLog=1073741824 +# +# ConsumeQueue每个文件默认存30W条,根据业务情况调整 +# +mapedFileSizeConsumeQueue=300000 +# +#destroyMapedFileIntervalForcibly=120000 +#redeleteHangedFileInterval=120000 +# +# 检测物理文件磁盘空间 +# +#diskMaxUsedSpaceRatio=88 diff --git a/carrera-prod/n01/broker/conf/logback_broker.xml b/carrera-prod/n01/broker/conf/logback_broker.xml new file mode 100644 index 0000000..d15c205 --- /dev/null +++ b/carrera-prod/n01/broker/conf/logback_broker.xml @@ -0,0 +1,337 @@ + + + + + + ${user.home}/logs/rocketmqlogs/broker_default.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/broker_default.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + ${user.home}/logs/rocketmqlogs/broker.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/broker.%i.log.gz + 1 + 20 + + + 128MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/protection.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/protection.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/watermark.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/watermark.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/store.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/store.%i.log.gz + 1 + 10 + + + 128MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/remoting.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/remoting.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/storeerror.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/storeerror.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + + ${user.home}/logs/rocketmqlogs/transaction.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/transaction.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/lock.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/lock.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/filter.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/filter.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/stats.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/stats.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p - %m%n + UTF-8 + + + + + ${user.home}/logs/rocketmqlogs/commercial.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/commercial.%i.log.gz + 1 + 10 + + + 500MB + + + + + true + + %d{yyy-MM-dd HH\:mm\:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n01/broker/conf/logback_filtersrv.xml b/carrera-prod/n01/broker/conf/logback_filtersrv.xml new file mode 100644 index 0000000..71b9a93 --- /dev/null +++ b/carrera-prod/n01/broker/conf/logback_filtersrv.xml @@ -0,0 +1,87 @@ + + + + + + ${user.home}/logs/rocketmqlogs/filtersrv_default.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/filtersrv_default.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + ${user.home}/logs/rocketmqlogs/filtersrv.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/filtersrv.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + 0 + + + + true + + %d{yyy-MM-dd HH\:mm\:ss,SSS} %p %t - %m%n + UTF-8 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n01/broker/conf/logback_namesrv.xml b/carrera-prod/n01/broker/conf/logback_namesrv.xml new file mode 100644 index 0000000..c68c8b6 --- /dev/null +++ b/carrera-prod/n01/broker/conf/logback_namesrv.xml @@ -0,0 +1,89 @@ + + + + + + ${user.home}/logs/rocketmqlogs/namesrv_default.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/namesrv_default.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + ${user.home}/logs/rocketmqlogs/namesrv.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/namesrv.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + 0 + + + + true + + %d{yyy-MM-dd HH\:mm\:ss,SSS} %p %t - %m%n + UTF-8 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n01/broker/conf/logback_tools.xml b/carrera-prod/n01/broker/conf/logback_tools.xml new file mode 100644 index 0000000..28283ad --- /dev/null +++ b/carrera-prod/n01/broker/conf/logback_tools.xml @@ -0,0 +1,93 @@ + + + + + + ${user.home}/logs/rocketmqlogs/tools_default.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/tools_default.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + ${user.home}/logs/rocketmqlogs/tools.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/tools.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + + true + + %d{yyy-MM-dd HH\:mm\:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n01/broker/control.sh b/carrera-prod/n01/broker/control.sh new file mode 100755 index 0000000..36ac3ea --- /dev/null +++ b/carrera-prod/n01/broker/control.sh @@ -0,0 +1,100 @@ +#!/bin/bash +MAIN_CLASS=rocketmq.broker.BrokerStartup +LOG_HOME="${HOME}"/logs/rocketmqlogs + +mkdir -p ${LOG_HOME} +mkdir -p "${HOME}"/rocketmq/broker-a/store +mkdir -p "${HOME}"/rocketmq/broker-b-s/store + +function get_pid() { + PID=$(ps ax | grep -i ${MAIN_CLASS} |grep java | grep -v grep | awk '{print $1}') +} + +function start() { + get_pid + if [ ! -z "$PID" ] ; then + echo "Shutdown old process($MAIN_CLASS) first, pid=${PID}" + exit 1 + fi + + echo "back up logs" + if [ -d ${LOG_HOME} ]; then + cd ${LOG_HOME} + for f in $(ls ${LOG_HOME}) + do + if [ -d $f ]; then + continue; + fi + if [ -f otherdays/$f ]; then + mv otherdays/$f otherdays/$f.old + fi + mv $f otherdays/ + done + fi + + + cd ${workspace} + nohup sh bin/mqbroker -c ${workspace}/conf/2m-2s-async/broker-a.properties -n"172.18.0.3:9876;172.18.0.4:9876" >> ${LOG_HOME}/broker-a.log 2>&1 & + echo "running: nohup sh bin/mqbroker -c ${workspace}/conf/2m-2s-async/broker-a.properties -n'172.18.0.3:9876;172.18.0.4:9876' >> ${LOG_HOME}/broker-a.log 2>&1 &" + + nohup sh bin/mqbroker -c ${workspace}/conf/2m-2s-async/broker-b-s.properties -n"172.18.0.3:9876;172.18.0.4:9876" >> ${LOG_HOME}/broker-b-s.log 2>&1 & + echo "running: nohup sh bin/mqbroker -c ${workspace}/conf/2m-2s-async/broker-b-s.properties -n'172.18.0.3:9876;172.18.0.4:9876' >> ${LOG_HOME}/broker-b-s.log 2>&1 &" + + get_pid + t=0 + while [[ -z ${PID} && "$t" -lt 10 ]]; do + echo "time=$t,starting process($MAIN_CLASS)" + get_pid + t=$(($t+1)) + sleep 0.5 + done + + if [ -z ${PID} ]; then + echo "start process($MAIN_CLASS) failed!!!" + exit 1 + else + echo "start process($MAIN_CLASS) success, pid=${PID}" + fi +} + +function stop() { + get_pid + if [ -z "$PID" ] ; then + echo "no process running..." + else + echo "killing process($MAIN_CLASS), pid=${PID}" + kill ${PID} + fi + + t=0 + while [[ ! -z ${PID} && "$t" -lt 60 ]]; do + echo "time=$t,killing process($MAIN_CLASS), pid=${PID}" + get_pid + t=$(($t+1)) + sleep 1 + done + + if [ ! -z ${PID} ]; then + echo "killing process($MAIN_CLASS), pid=${PID}" + exit 1 + fi +} + +workspace=$(cd $(dirname $0) && pwd -P) +cd ${workspace} + +case "$1" in + "start") + start + ;; + "stop") + stop + ;; + "reload") + stop + start + ;; + *) + echo "supporting cmd: start/stop/reload" + ;; +esac diff --git a/carrera-prod/n01/chronos/conf/chronos.yaml b/carrera-prod/n01/chronos/conf/chronos.yaml new file mode 100644 index 0000000..89b441c --- /dev/null +++ b/carrera-prod/n01/chronos/conf/chronos.yaml @@ -0,0 +1,118 @@ +#cluster, for master election purpose +clusterName : test +#group in cluster, for master election purpose +groupName : group_0 +pullOn : true +pushOn : true +deleteOn : true +standAlone : false +fakeSend : false + +dbConfig: + dbPath : "/root/chronos-storage/rocksdb" + seekTimestampPath : "/root/chronos-storage/seektimestamp" + + # path Where to keep the backup files. Has to be different than dbname + dbPathBackup : "/root/chronos-storage/rocksdb_backup" + dbPathRestore : "/root/chronos-storage/rocksdb_restore" + + # https://github.com/facebook/rocksdb/wiki/RocksDB-Tuning-Guide#compaction-stats + # Parallelism options + # In LSM architecture, there are two background processes: flush and compaction. + # Both can execute concurrently via threads to take advantage of storage technology + # concurrency. Flush threads are in the HIGH priority pool, while compaction threads + # are in the LOW priority pool. To benefit from more threads you might need to set + # these options to change the max number of concurrent compactions and flushes: + # max_background_flushes is the maximum number of concurrent flush operations. + # It is usually good enough to set this to 1. + maxBackgroundFlushes : 10 + + # max_background_compactions is the maximum number of concurrent background compactions. + # The default is 1, but to fully utilize your CPU and storage you might want to + # increase this to approximately number of cores in the system. + maxBackgroundCompactions : 35 + baseBackgroundCompactions : 5 + + # RocksDB memtable 的大小, 单位 MB + writeBufferSize : 128 + + # 最多允许几个 memtable 存在。写入到 RocksDB 的数据首先会记录到 WAL 日志里面,然后会插入到 + # memtable 里面,当 memtable 的大小到达了 write-buffer-size 限定的大小的时候,当前的 + # memtable 会变成只读的,然后生成一个新的 memtable 接收新的写入。只读的 memtable 会被 + # RocksDB 的 flush 线程(max-background-flushes 参数能够控制 flush 线程的最大个数) + # flush 到磁盘,成为 level0 的一个 sst 文件。当 flush 线程忙不过来,导致等待 flush 到磁盘的 + # memtable 的数量到达 max-write-buffer-number 限定的个数的时候,RocksDB 会将新的写入 + # stall 住,stall 是 RocksDB 的一种流控机制。在导数据的时候可以将 max-write-buffer-number + # 的值设置的更大一点,例如 10。 + maxWriteBufferNumber : 10 + + maxSubcompactions : 10 + + # 当 level0 的 sst 文件个数到达 level0-slowdown-writes-trigger 指定的限度的时候, + # RocksDB 会尝试减慢写入的速度。因为 level0 的 sst 太多会导致 RocksDB 的读放大上升。 + # level0-slowdown-writes-trigger 和 level0-stop-writes-trigger 是 RocksDB 进行流控的 + # 另一个表现。当 level0 的 sst 的文件个数到达 4(默认值),level0 的 sst 文件会和 level1 中 + # 有 overlap 的 sst 文件进行 compaction,缓解读放大的问题。 + level0SlowdownWritesTrigger : 30 + + # 当 level0 的 sst 文件个数到达 level0-stop-writes-trigger 指定的限度的时候,RocksDB 会 + # stall 住新的写入。 + level0StopWritesTrigger : 50 + + # 当 level1 的数据量大小达到 max-bytes-for-level-base 限定的值的时候,会触发 level1 的 + # sst 和 level2 种有 overlap 的 sst 进行 compaction。 + # 黄金定律:max-bytes-for-level-base 的设置的第一参考原则就是保证和 level0 的数据量大致相 + # 等,这样能够减少不必要的 compaction。例如压缩方式为"no:no:lz4:lz4:lz4:lz4:lz4",那么 + # max-bytes-for-level-base 的值应该是 write-buffer-size 的大小乘以 4,因为 level0 和 + # level1 都没有压缩,而且 level0 触发 compaction 的条件是 sst 的个数到达 4(默认值)。在 + # level0 和 level1 都采取了压缩的情况下,就需要分析下 RocksDB 的日志,看一个 memtable 的压 + # 缩成一个 sst 文件的大小大概是多少,例如 32MB,那么 max-bytes-for-level-base 的建议值就应 + # 该是 32MB * 4 = 128MB。 + maxBytesForLevelBase : 512 + + + # sst 文件的大小。level0 的 sst 文件的大小受 write-buffer-size 和 level0 采用的压缩算法的 + # 影响,target-file-size-base 参数用于控制 level1-level6 单个 sst 文件的大小。 + targetFileSizeBase : 128 + + delayedWriteRate : 64 + +pullConfig: + innerGroup : cg_R_test_chronos_inner_0_1 + innerTopic : R_test_chronos_inner_0 + cproxyAddrs : 127.0.0.1:9713 #分号分割 + retryIntervalMs : 500 + maxBatchSize : 200 + timeoutMs : 3000 + pullBatchItemNum : 10000 + threadNum : 10 + msgByteBaseLen : 1000 + +pushConfig: + pproxyAddrs : + - 127.0.0.1:9613 + proxyTimeoutMs : 200 + clientRetry : 2 + clientTimeoutMs : 300 + poolSize : 100 + pushIntervalMs : 300 + batchSendThreadNum : 50 + +deleteConfig: + deleteWhen : 04 + saveHours : 6 + +zkConfig: + zkAddrs : "127.0.0.1:2181" + zkSessionTimeoutMs : 30000 + masterPathPrefix : "/chronos/master" + metaPathPrefix : "/chronos/meta" + offsetsProp : "offsets" + seekTimestampProp : "seektimestamp" + baseSleepTimeMs : 10 #baseSleepTimeMs initial amount of time to wait between retries + maxSleepMs : 1000 #maxSleepMs max time in ms to sleep on each retry + maxRetries : 5 #maxRetries max number of times to retry + + + + diff --git a/carrera-prod/n01/chronos/conf/log4j2.xml b/carrera-prod/n01/chronos/conf/log4j2.xml new file mode 100644 index 0000000..37fb73b --- /dev/null +++ b/carrera-prod/n01/chronos/conf/log4j2.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n01/chronos/conf/test-chronos00.yaml b/carrera-prod/n01/chronos/conf/test-chronos00.yaml new file mode 100644 index 0000000..9156519 --- /dev/null +++ b/carrera-prod/n01/chronos/conf/test-chronos00.yaml @@ -0,0 +1,118 @@ +#所属集群, 用于选举master +clusterName : test +#所属集群中的组, 用于选举master +groupName : group_0 +pullOn : true +pushOn : true +deleteOn : true +standAlone : false +fakeSend : false + +dbConfig: + dbPath : "/home/xiaoju/chronos-storage/rocksdb" + seekTimestampPath : "/home/xiaoju/chronos-storage/seektimestamp" + + # path Where to keep the backup files. Has to be different than dbname + dbPathBackup : "/home/xiaoju/chronos-storage/rocksdb_backup" + dbPathRestore : "/home/xiaoju/chronos-storage/rocksdb_restore" + + # https://github.com/facebook/rocksdb/wiki/RocksDB-Tuning-Guide#compaction-stats + # Parallelism options + # In LSM architecture, there are two background processes: flush and compaction. + # Both can execute concurrently via threads to take advantage of storage technology + # concurrency. Flush threads are in the HIGH priority pool, while compaction threads + # are in the LOW priority pool. To benefit from more threads you might need to set + # these options to change the max number of concurrent compactions and flushes: + # max_background_flushes is the maximum number of concurrent flush operations. + # It is usually good enough to set this to 1. + maxBackgroundFlushes : 10 + + # max_background_compactions is the maximum number of concurrent background compactions. + # The default is 1, but to fully utilize your CPU and storage you might want to + # increase this to approximately number of cores in the system. + maxBackgroundCompactions : 35 + baseBackgroundCompactions : 5 + + # RocksDB memtable 的大小, 单位 MB + writeBufferSize : 128 + + # 最多允许几个 memtable 存在。写入到 RocksDB 的数据首先会记录到 WAL 日志里面,然后会插入到 + # memtable 里面,当 memtable 的大小到达了 write-buffer-size 限定的大小的时候,当前的 + # memtable 会变成只读的,然后生成一个新的 memtable 接收新的写入。只读的 memtable 会被 + # RocksDB 的 flush 线程(max-background-flushes 参数能够控制 flush 线程的最大个数) + # flush 到磁盘,成为 level0 的一个 sst 文件。当 flush 线程忙不过来,导致等待 flush 到磁盘的 + # memtable 的数量到达 max-write-buffer-number 限定的个数的时候,RocksDB 会将新的写入 + # stall 住,stall 是 RocksDB 的一种流控机制。在导数据的时候可以将 max-write-buffer-number + # 的值设置的更大一点,例如 10。 + maxWriteBufferNumber : 10 + + maxSubcompactions : 10 + + # 当 level0 的 sst 文件个数到达 level0-slowdown-writes-trigger 指定的限度的时候, + # RocksDB 会尝试减慢写入的速度。因为 level0 的 sst 太多会导致 RocksDB 的读放大上升。 + # level0-slowdown-writes-trigger 和 level0-stop-writes-trigger 是 RocksDB 进行流控的 + # 另一个表现。当 level0 的 sst 的文件个数到达 4(默认值),level0 的 sst 文件会和 level1 中 + # 有 overlap 的 sst 文件进行 compaction,缓解读放大的问题。 + level0SlowdownWritesTrigger : 30 + + # 当 level0 的 sst 文件个数到达 level0-stop-writes-trigger 指定的限度的时候,RocksDB 会 + # stall 住新的写入。 + level0StopWritesTrigger : 50 + + # 当 level1 的数据量大小达到 max-bytes-for-level-base 限定的值的时候,会触发 level1 的 + # sst 和 level2 种有 overlap 的 sst 进行 compaction。 + # 黄金定律:max-bytes-for-level-base 的设置的第一参考原则就是保证和 level0 的数据量大致相 + # 等,这样能够减少不必要的 compaction。例如压缩方式为"no:no:lz4:lz4:lz4:lz4:lz4",那么 + # max-bytes-for-level-base 的值应该是 write-buffer-size 的大小乘以 4,因为 level0 和 + # level1 都没有压缩,而且 level0 触发 compaction 的条件是 sst 的个数到达 4(默认值)。在 + # level0 和 level1 都采取了压缩的情况下,就需要分析下 RocksDB 的日志,看一个 memtable 的压 + # 缩成一个 sst 文件的大小大概是多少,例如 32MB,那么 max-bytes-for-level-base 的建议值就应 + # 该是 32MB * 4 = 128MB。 + maxBytesForLevelBase : 512 + + + # sst 文件的大小。level0 的 sst 文件的大小受 write-buffer-size 和 level0 采用的压缩算法的 + # 影响,target-file-size-base 参数用于控制 level1-level6 单个 sst 文件的大小。 + targetFileSizeBase : 128 + + delayedWriteRate : 64 + +pullConfig: + innerGroup : cg_R_test_chronos_inner_0_0 + innerTopic : R_test_chronos_inner_0 + cproxyAddrs : 127.0.0.1:9713 #分号分割 + retryIntervalMs : 500 + maxBatchSize : 200 + timeoutMs : 3000 + pullBatchItemNum : 10000 + threadNum : 10 + msgByteBaseLen : 1000 + +pushConfig: + pproxyAddrs : + - 127.0.0.1:9613 + proxyTimeoutMs : 200 + clientRetry : 2 + clientTimeoutMs : 300 + poolSize : 100 + pushIntervalMs : 300 + batchSendThreadNum : 50 + +deleteConfig: + deleteWhen : 04 + saveHours : 6 + +zkConfig: + zkAddrs : "127.0.0.1:2181" + zkSessionTimeoutMs : 30000 + masterPathPrefix : "/chronos/master" + metaPathPrefix : "/chronos/meta" + offsetsProp : "offsets" + seekTimestampProp : "seektimestamp" + baseSleepTimeMs : 10 #baseSleepTimeMs initial amount of time to wait between retries + maxSleepMs : 1000 #maxSleepMs max time in ms to sleep on each retry + maxRetries : 5 #maxRetries max number of times to retry + + + + diff --git a/carrera-prod/n01/chronos/conf/test-chronos01.yaml b/carrera-prod/n01/chronos/conf/test-chronos01.yaml new file mode 100644 index 0000000..5831ffd --- /dev/null +++ b/carrera-prod/n01/chronos/conf/test-chronos01.yaml @@ -0,0 +1,118 @@ +#所属集群, 用于选举master +clusterName : test +#所属集群中的组, 用于选举master +groupName : group_0 +pullOn : true +pushOn : true +deleteOn : true +standAlone : false +fakeSend : false + +dbConfig: + dbPath : "/home/xiaoju/chronos-storage/rocksdb" + seekTimestampPath : "/home/xiaoju/chronos-storage/seektimestamp" + + # path Where to keep the backup files. Has to be different than dbname + dbPathBackup : "/home/xiaoju/chronos-storage/rocksdb_backup" + dbPathRestore : "/home/xiaoju/chronos-storage/rocksdb_restore" + + # https://github.com/facebook/rocksdb/wiki/RocksDB-Tuning-Guide#compaction-stats + # Parallelism options + # In LSM architecture, there are two background processes: flush and compaction. + # Both can execute concurrently via threads to take advantage of storage technology + # concurrency. Flush threads are in the HIGH priority pool, while compaction threads + # are in the LOW priority pool. To benefit from more threads you might need to set + # these options to change the max number of concurrent compactions and flushes: + # max_background_flushes is the maximum number of concurrent flush operations. + # It is usually good enough to set this to 1. + maxBackgroundFlushes : 10 + + # max_background_compactions is the maximum number of concurrent background compactions. + # The default is 1, but to fully utilize your CPU and storage you might want to + # increase this to approximately number of cores in the system. + maxBackgroundCompactions : 35 + baseBackgroundCompactions : 5 + + # RocksDB memtable 的大小, 单位 MB + writeBufferSize : 128 + + # 最多允许几个 memtable 存在。写入到 RocksDB 的数据首先会记录到 WAL 日志里面,然后会插入到 + # memtable 里面,当 memtable 的大小到达了 write-buffer-size 限定的大小的时候,当前的 + # memtable 会变成只读的,然后生成一个新的 memtable 接收新的写入。只读的 memtable 会被 + # RocksDB 的 flush 线程(max-background-flushes 参数能够控制 flush 线程的最大个数) + # flush 到磁盘,成为 level0 的一个 sst 文件。当 flush 线程忙不过来,导致等待 flush 到磁盘的 + # memtable 的数量到达 max-write-buffer-number 限定的个数的时候,RocksDB 会将新的写入 + # stall 住,stall 是 RocksDB 的一种流控机制。在导数据的时候可以将 max-write-buffer-number + # 的值设置的更大一点,例如 10。 + maxWriteBufferNumber : 10 + + maxSubcompactions : 10 + + # 当 level0 的 sst 文件个数到达 level0-slowdown-writes-trigger 指定的限度的时候, + # RocksDB 会尝试减慢写入的速度。因为 level0 的 sst 太多会导致 RocksDB 的读放大上升。 + # level0-slowdown-writes-trigger 和 level0-stop-writes-trigger 是 RocksDB 进行流控的 + # 另一个表现。当 level0 的 sst 的文件个数到达 4(默认值),level0 的 sst 文件会和 level1 中 + # 有 overlap 的 sst 文件进行 compaction,缓解读放大的问题。 + level0SlowdownWritesTrigger : 30 + + # 当 level0 的 sst 文件个数到达 level0-stop-writes-trigger 指定的限度的时候,RocksDB 会 + # stall 住新的写入。 + level0StopWritesTrigger : 50 + + # 当 level1 的数据量大小达到 max-bytes-for-level-base 限定的值的时候,会触发 level1 的 + # sst 和 level2 种有 overlap 的 sst 进行 compaction。 + # 黄金定律:max-bytes-for-level-base 的设置的第一参考原则就是保证和 level0 的数据量大致相 + # 等,这样能够减少不必要的 compaction。例如压缩方式为"no:no:lz4:lz4:lz4:lz4:lz4",那么 + # max-bytes-for-level-base 的值应该是 write-buffer-size 的大小乘以 4,因为 level0 和 + # level1 都没有压缩,而且 level0 触发 compaction 的条件是 sst 的个数到达 4(默认值)。在 + # level0 和 level1 都采取了压缩的情况下,就需要分析下 RocksDB 的日志,看一个 memtable 的压 + # 缩成一个 sst 文件的大小大概是多少,例如 32MB,那么 max-bytes-for-level-base 的建议值就应 + # 该是 32MB * 4 = 128MB。 + maxBytesForLevelBase : 512 + + + # sst 文件的大小。level0 的 sst 文件的大小受 write-buffer-size 和 level0 采用的压缩算法的 + # 影响,target-file-size-base 参数用于控制 level1-level6 单个 sst 文件的大小。 + targetFileSizeBase : 128 + + delayedWriteRate : 64 + +pullConfig: + innerGroup : cg_R_test_chronos_inner_0_1 + innerTopic : R_test_chronos_inner_0 + cproxyAddrs : 127.0.0.1:9713 #分号分割 + retryIntervalMs : 500 + maxBatchSize : 200 + timeoutMs : 3000 + pullBatchItemNum : 10000 + threadNum : 10 + msgByteBaseLen : 1000 + +pushConfig: + pproxyAddrs : + - 127.0.0.1:9613 + proxyTimeoutMs : 200 + clientRetry : 2 + clientTimeoutMs : 300 + poolSize : 100 + pushIntervalMs : 300 + batchSendThreadNum : 50 + +deleteConfig: + deleteWhen : 04 + saveHours : 6 + +zkConfig: + zkAddrs : "127.0.0.1:2181" + zkSessionTimeoutMs : 30000 + masterPathPrefix : "/chronos/master" + metaPathPrefix : "/chronos/meta" + offsetsProp : "offsets" + seekTimestampProp : "seektimestamp" + baseSleepTimeMs : 10 #baseSleepTimeMs initial amount of time to wait between retries + maxSleepMs : 1000 #maxSleepMs max time in ms to sleep on each retry + maxRetries : 5 #maxRetries max number of times to retry + + + + diff --git a/carrera-prod/n01/chronos/control.sh b/carrera-prod/n01/chronos/control.sh new file mode 100755 index 0000000..15d6ffd --- /dev/null +++ b/carrera-prod/n01/chronos/control.sh @@ -0,0 +1,116 @@ +#!/bin/bash + +MAIN_CLASS=com.xiaojukeji.chronos.ChronosMain +CHRONOS_VERSION="1.0.0-SNAPSHOT" + +function start() { + OLD_PID="`pgrep -f ${MAIN_CLASS}`" + if [ "$OLD_PID" ]; then + echo "Chronos is already running, pid=$OLD_PID. Stop it first!" + exit 1 + fi + + BASEDIR=$(dirname "$0") + cd "${BASEDIR}" + CHRONOS_HOME=`pwd` + CHRONOS_LOG=${CHRONOS_HOME}/logs + mkdir -p ${CHRONOS_LOG}/old + + # set config + LOG_CARRERA_LEVEL="INFO" + CHRONOS_CONFIG="${CHRONOS_HOME}/conf/chronos.yaml" + LOG_SAVE_SIZE="1G" + LOG_SAVE_TIME="7d" + MEM_OPTS="-Xms256m -Xmx256m -Xmn256m" + + export LOG_SAVE_SIZE + export LOG_SAVE_TIME + export LOG_CARRERA_LEVEL + echo "MEM_OPTS:"${MEM_OPTS} + echo "JAVA_OPTS:"${JAVA_OPTS} + echo "LOG_SAVE_SIZE:"${LOG_SAVE_SIZE}", LOG_SAVE_TIME:"${LOG_SAVE_TIME}", LOG_CARRERA_LEVEL:"${LOG_CARRERA_LEVEL} + + if [ ! -f ${CHRONOS_CONFIG} ]; then + date >> ${CHRONOS_LOG}/control.log + echo "configure is not existed!" >> ${CHRONOS_LOG}/control.log + exit 1 + fi + echo "Use ${CHRONOS_CONFIG} configure" + + # backup log + LOG_NAMES=(carrera.log error.log metric.log gc.log jstat.log) + LOG_SUFFIX=$(date +%Y%m%d-%H%M%S) + for var in ${LOG_NAMES[@]}; + do + if [ -f "${CHRONOS_LOG}/${var}" ]; then + mv "${CHRONOS_LOG}/${var}" "${CHRONOS_LOG}/old/${var}.${LOG_SUFFIX}" + fi + done + + JVM_OPTS="${MEM_OPTS} ${JVM_OPTS} " + JVM_OPTS="${JVM_OPTS} -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=50 -XX:+UseCMSInitiatingOccupancyOnly" + JVM_OPTS="${JVM_OPTS} -XX:+PreserveFramePointer -XX:-UseBiasedLocking -XX:-OmitStackTraceInFastThrow" + JVM_OPTS="${JVM_OPTS} -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:${CHRONOS_LOG}/gc.log" + JVM_OPTS="${JVM_OPTS} -XX:+PrintSafepointStatistics" + CLASSPATH="${CHRONOS_HOME}/chronos-${CHRONOS_VERSION}-jar-with-dependencies.jar":${CLASSPATH} + + JAVA_OPTS="${JAVA_OPTS} -Dlog4j.configurationFile=file://${CHRONOS_HOME}/conf/log4j2.xml" + JAVA_OPTS="${JAVA_OPTS} -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector" + + CONSOLE_LOG=${CHRONOS_LOG}/console.`date +%Y-%m-%d`.log + date >> ${CONSOLE_LOG} + + java ${JVM_OPTS} ${JAVA_OPTS} -cp ${CLASSPATH} ${MAIN_CLASS} ${CHRONOS_CONFIG} >> ${CONSOLE_LOG} 2>&1 & + sleep 2 + date >> ${CHRONOS_LOG}/control.log + PID="`pgrep -f ${MAIN_CLASS}`" + if [ "$PID" ]; then + echo "NEW Chronos is running, pid=$PID" + echo "New Chronos is running, pid=$PID" >> ${CHRONOS_LOG}/control.log + jstat -gcutil -t $PID 30s >> ${CHRONOS_LOG}/gstat.log & + else + echo "Start Chronos Failed" + echo "Start Chronos Failed" >> ${CHRONOS_LOG}/control.log + exit 1 + fi +} + +function stop() { + BASEDIR=$(dirname "$0") + cd "${BASEDIR}" + CHRONOS_HOME=`pwd` + CHRONOS_LOG=${CHRONOS_HOME}/logs + mkdir -p ${CHRONOS_LOG} + + date >> ${CHRONOS_LOG}/control.log + echo "Killing Chronos =`pgrep -f ${MAIN_CLASS}`" >> ${CHRONOS_LOG}/control.log + kill -15 `pgrep -f ${MAIN_CLASS}` + t=0 + while [[ `pgrep -f ${MAIN_CLASS}` && "$t" -lt 60 ]]; do + echo "time=$t,killing `pgrep -f ${MAIN_CLASS}`" + t=$(($t+1)) + sleep 1 + done + if [ `pgrep -f ${MAIN_CLASS}` ]; then + echo "stop timeout" + echo "Stop Chronos Failed" >> ${CHRONOS_LOG}/control.log + exit 1 + fi + echo "KILLED" >> ${CHRONOS_LOG}/control.log +} + +case "$1" in + "start") + start + ;; + "stop") + stop + ;; + "reload") + stop + start + ;; + *) + echo "supporting cmd: start/stop/reload" + ;; +esac \ No newline at end of file diff --git a/carrera-prod/n01/console/carrera.war b/carrera-prod/n01/console/carrera.war new file mode 100644 index 0000000..9b6deb9 Binary files /dev/null and b/carrera-prod/n01/console/carrera.war differ diff --git a/carrera-prod/n01/console/control.sh b/carrera-prod/n01/console/control.sh new file mode 100755 index 0000000..7f53986 --- /dev/null +++ b/carrera-prod/n01/console/control.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +WEBAPPS="/root/tomcat/webapps" +TOMCATBIN="/root/tomcat/bin" + +function start() { + OLD_PID="`pgrep -f org.apache.catalina.startup.Bootstrap`" + if [ "$OLD_PID" ]; then + echo "tomcat is already running, pid=$OLD_PID. Stop it first!" >> control.log + exit 1 + fi + + rm -rf $WEBAPPS/carrera + rm $WEBAPPS/carrera.war + cp carrera.war $WEBAPPS + $TOMCATBIN/startup.sh + echo "tomcat started" >> control.log +} + +function stop() { + if [[ `pgrep -f org.apache.catalina.startup.Bootstrap` ]]; then + pkill -9 -f org.apache.catalina.startup.Bootstrap + fi + t=0 + while [[ `pgrep -f org.apache.catalina.startup.Bootstrap` && "$t" -lt 30 ]]; do + sleep 1 + done + if [[ `pgrep -f org.apache.catalina.startup.Bootstrap` ]]; then + echo "stop tomcat failed" >> control.log + exit 1 + fi + echo "tomcat stopped" >> control.log +} + +case "$1" in + "start") + start + ;; + "stop") + stop + ;; + "reload") + stop + start + ;; + *) + echo "supporting cmd: start/stop/reload" + ;; +esac diff --git a/carrera-prod/n01/consumer/conf/carrera.yaml b/carrera-prod/n01/consumer/conf/carrera.yaml new file mode 100644 index 0000000..a878a3b --- /dev/null +++ b/carrera-prod/n01/consumer/conf/carrera.yaml @@ -0,0 +1,3 @@ +zookeeperAddr: 172.18.0.3:2181/carrera/v4/config # config zk cluster address here. +host: 172.18.0.3 # local ip +port: 9713 # thrift server port. diff --git a/carrera-prod/n01/consumer/conf/log4j2.xml b/carrera-prod/n01/consumer/conf/log4j2.xml new file mode 100644 index 0000000..f46b334 --- /dev/null +++ b/carrera-prod/n01/consumer/conf/log4j2.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n01/consumer/control.sh b/carrera-prod/n01/consumer/control.sh new file mode 100755 index 0000000..fd63113 --- /dev/null +++ b/carrera-prod/n01/consumer/control.sh @@ -0,0 +1,107 @@ +#!/bin/bash +MAINCLASS=com.xiaojukeji.carrera.cproxy.proxy.ConsumerProxyMain +CARRERA_VERSION="1.0.0-SNAPSHOT" +CONTROL_LOG="logs/control.log" + +function start() { + OLD_PID="`pgrep -f ${MAINCLASS}`" + if [ "$OLD_PID" ]; then + echo "Proxy is already running, pid=$OLD_PID. Stop it first!" + exit 1 + fi + + BASEDIR=$(dirname "$0") + cd "${BASEDIR}" + PROXY_HOME=`pwd` + mkdir -p logs/old + + CARRERA_CONFIG="${PROXY_HOME}/conf/carrera.yaml" + + # backup log + LOG_NAMES=(carrera.log drop.log error.log main.log metric.log gc.log jstat.log) + LOG_SUFFIX=$(date +%Y%m%d-%H%M%S) + for var in ${LOG_NAMES[@]}; + do + if [ -f "${PROXY_HOME}/logs/${var}" ]; then + mv "${PROXY_HOME}/logs/${var}" "${PROXY_HOME}/logs/old/${var}.${LOG_SUFFIX}" + fi + done + + # set config + LOG_BASE_CONSUMER_LEVEL="INFO" + MEM_OPTS="-Xms512m -Xmx512m" + LOG_SAVE_SIZE="1GB" + LOG_SAVE_TIME="7d" + + export LOG_SAVE_SIZE + export LOG_SAVE_TIME + export LOG_BASE_CONSUMER_LEVEL + + echo "MEM_OPTS: " ${MEM_OPTS} + echo "LOG_SAVE_SIZE="$LOG_SAVE_SIZE", LOG_SAVE_TIME="$LOG_SAVE_TIME", LOG_BASE_CONSUMER_LEVEL="$LOG_BASE_CONSUMER_LEVEL + + JVM_OPTS="${MEM_OPTS} ${JVM_OPTS} " + JVM_OPTS="${JVM_OPTS} -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=50 -XX:+UseCMSInitiatingOccupancyOnly" + JVM_OPTS="${JVM_OPTS} -XX:+PreserveFramePointer -XX:-UseBiasedLocking -XX:-OmitStackTraceInFastThrow" + JVM_OPTS="${JVM_OPTS} -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:${PROXY_HOME}/logs/gc.log" + + JAVA_OPTS="${JAVA_OPTS} -Dlog4j.configurationFile=file://${PROXY_HOME}/conf/log4j2.xml" + JAVA_OPTS="${JAVA_OPTS} -Drocketmq.client.log.loadconfig=false" + JAVA_OPTS="${JAVA_OPTS} -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector" + JAVA_OPTS="${JAVA_OPTS} -Drocketmq.client.maxTimeConsumeContinuously=1000" + + CLASSPATH="${PROXY_HOME}/carrera-consumer-${CARRERA_VERSION}-jar-with-dependencies.jar":$CLASSPATH + + CONSOLE_LOG=${PROXY_HOME}/logs/console.`date +%Y-%m-%d`.log + date >> ${CONSOLE_LOG} + + java ${JVM_OPTS} ${JAVA_OPTS} -cp ${CLASSPATH} ${MAINCLASS} ${CARRERA_CONFIG} >> ${CONSOLE_LOG} 2>&1 & + sleep 2 + date >> ${CONTROL_LOG} + PID="`pgrep -f ${MAINCLASS}`" + if [ "$PID" ]; then + echo "New Proxy is running, pid=$PID" >> ${CONTROL_LOG} + jstat -gcutil -t $PID 30s >> ${PROXY_HOME}/logs/jstat.log 2>&1 & + else + echo "Start Proxy Failed" >> ${CONTROL_LOG} + exit 1 + fi +} + +function stop() { + date >> ${CONTROL_LOG} + PID=$(pgrep -f ${MAINCLASS}) + echo "Killing Proxy =$PID" >> ${CONTROL_LOG} + pkill -f "jstat -gcutil -t $PID 30s" + pkill -f hangAlarm.sh + pkill -15 -f ${MAINCLASS} + t=0 + while [[ `pgrep -f ${MAINCLASS}` && "$t" -lt 120 ]]; do + echo "time=$t,killing `pgrep -f ${MAINCLASS}`" + t=$(($t+1)) + sleep 1 + done + if [ `pgrep -f ${MAINCLASS}` ]; then + echo "stop timeout" + echo "Stop Proxy Failed" >> ${CONTROL_LOG} + exit 1 + fi + echo "KILLED" >> ${CONTROL_LOG} +} + +case "$1" in + "start") + start + ;; + "stop") + stop + ;; + "reload") + stop + start + ;; + *) + echo "supporting cmd: start/stop/reload" + ;; +esac + diff --git a/carrera-prod/n01/namesvr/LICENSE b/carrera-prod/n01/namesvr/LICENSE new file mode 100644 index 0000000..3726172 --- /dev/null +++ b/carrera-prod/n01/namesvr/LICENSE @@ -0,0 +1,334 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (properties) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +------ +This product has a bundle logback, which is available under the EPL v1.0 License. +The source code of logback can be found at https://github.com/qos-ch/logback. + +Logback LICENSE +--------------- + +Logback: the reliable, generic, fast and flexible logging framework. +Copyright (C) 1999-2015, QOS.ch. All rights reserved. + +This program and the accompanying materials are dual-licensed under +either the terms of the Eclipse Public License v1.0 as published by +the Eclipse Foundation + + or (per the licensee's choosing) + +under the terms of the GNU Lesser General Public License version 2.1 +as published by the Free Software Foundation. + +------ +This product has a bundle slf4j, which is available under the MIT License. +The source code of slf4j can be found at https://github.com/qos-ch/slf4j. + + Copyright (c) 2004-2017 QOS.ch + All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +------ +This product has a bundle fastjson, which is available under the ASL2 License. +The source code of fastjson can be found at https://github.com/alibaba/fastjson. + + Copyright 1999-2016 Alibaba Group Holding Ltd. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +------ +This product has a bundle javassist, which is available under the ASL2 License. +The source code of javassist can be found at https://github.com/jboss-javassist/javassist. + + Copyright (C) 1999- by Shigeru Chiba, All rights reserved. + + Javassist (JAVA programming ASSISTant) makes Java bytecode manipulation simple. + It is a class library for editing bytecodes in Java; it enables Java programs to define a new class + at runtime and to modify a class file when the JVM loads it. Unlike other similar bytecode editors, + Javassist provides two levels of API: source level and bytecode level. If the users use the source- level API, + they can edit a class file without knowledge of the specifications of the Java bytecode. + The whole API is designed with only the vocabulary of the Java language. + You can even specify inserted bytecode in the form of source text; Javassist compiles it on the fly. + On the other hand, the bytecode-level API allows the users to directly edit a class file as other editors. + + This software is distributed under the Mozilla Public License Version 1.1, + the GNU Lesser General Public License Version 2.1 or later, or the Apache License Version 2.0. + +------ +This product has a bundle jna, which is available under the ASL2 License. +The source code of jna can be found at https://github.com/java-native-access/jna. + + This copy of JNA is licensed under the + Apache (Software) License, version 2.0 ("the License"). + See the License for details about distribution rights, and the + specific rights regarding derivate works. + + You may obtain a copy of the License at: + + http://www.apache.org/licenses/ + + A copy is also included in the downloadable source code package + containing JNA, in file "AL2.0", under the same directory + as this file. +------ +This product has a bundle guava, which is available under the ASL2 License. +The source code of guava can be found at https://github.com/google/guava. + + Copyright (C) 2007 The Guava authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +------ +This product has a bundle OpenMessaging, which is available under the ASL2 License. +The source code of OpenMessaging can be found at https://github.com/openmessaging/openmessaging. + + Copyright (C) 2017 The OpenMessaging authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/carrera-prod/n01/namesvr/NOTICE b/carrera-prod/n01/namesvr/NOTICE new file mode 100644 index 0000000..c91dc22 --- /dev/null +++ b/carrera-prod/n01/namesvr/NOTICE @@ -0,0 +1,36 @@ +Apache RocketMQ +Copyright 2016-2017 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +------ +This product has a bundle netty: + The Netty Project + ================= + +Please visit the Netty web site for more information: + + * http://netty.io/ + +Copyright 2014 The Netty Project + +The Netty Project licenses this file to you under the Apache License, +version 2.0 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations +under the License. + +Also, please refer to each LICENSE..txt file, which is located in +the 'license' directory of the distribution file, for the license terms of the +components that this product depends on. + +------ +This product has a bundle commons-lang, which includes software from the Spring Framework, +under the Apache License 2.0 (see: StringUtils.containsWhitespace()) \ No newline at end of file diff --git a/carrera-prod/n01/namesvr/README.md b/carrera-prod/n01/namesvr/README.md new file mode 100644 index 0000000..b86ac71 --- /dev/null +++ b/carrera-prod/n01/namesvr/README.md @@ -0,0 +1,2 @@ +## Apache RocketMQ Didi 内部分支,作为DDMQ的存储引擎之一。 + diff --git a/carrera-prod/n01/namesvr/bin/README.md b/carrera-prod/n01/namesvr/bin/README.md new file mode 100755 index 0000000..efbb67d --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/README.md @@ -0,0 +1,29 @@ +### Operating system tuning +Before deploying broker servers, it's highly recommended to run **os.sh**, which is to optimize your operating system for better performance. + +## Notice +### os.sh should be executed only once with root permission. +### os.sh parameter settings are for reference purpose only. You can tune them according to your target host configurations. + + +### Start broker +* Unix platform + + `nohup sh mqbroker &` + +### Shutdown broker + sh mqshutdown broker + +### Start Nameserver +* Unix platform + + `nohup sh mqnamesrv &` + +### Shutdown Nameserver + sh mqshutdown namesrv + +### Update or create Topic + sh mqadmin updateTopic -b 127.0.0.1:10911 -t TopicA + +### Update or create subscription group + sh mqadmin updateSubGroup -b 127.0.0.1:10911 -g SubGroupA \ No newline at end of file diff --git a/carrera-prod/n01/namesvr/bin/cachedog.sh b/carrera-prod/n01/namesvr/bin/cachedog.sh new file mode 100755 index 0000000..9329fdb --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/cachedog.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=$PATH:/sbin + +while true; do + nr_free_pages=`fgrep -A 10 Normal /proc/zoneinfo |grep nr_free_pages |awk -F ' ' '{print $2}'` + high=`fgrep -A 10 Normal /proc/zoneinfo |grep high |awk -F ' ' '{print $2}'` + + NOW_DATE=`date +%D` + NOW_TIME=`date +%T` + + if [ ${nr_free_pages} -le ${high} ]; then + sysctl -w vm.drop_caches=3 + nr_free_pages_new=`fgrep -A 10 Normal /proc/zoneinfo |grep nr_free_pages |awk -F ' ' '{print $2}'` + + printf "%s %s [CLEAN] nr_free_pages < high, clean cache. nr_free_pages=%s ====> nr_free_pages=%s\n" "${NOW_DATE}" "${NOW_TIME}" ${nr_free_pages} ${nr_free_pages_new} + + sysctl -w vm.drop_caches=1 + echo + echo + echo + else + printf "%s %s [NOTHING] nr_free_pages=%s high=%s\n" "${NOW_DATE}" "${NOW_TIME}" ${nr_free_pages} ${high} + fi + + sleep 1 +done diff --git a/carrera-prod/n01/namesvr/bin/cleancache.sh b/carrera-prod/n01/namesvr/bin/cleancache.sh new file mode 100755 index 0000000..9c6e9ab --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/cleancache.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=$PATH:/sbin + +sysctl -w vm.drop_caches=3 diff --git a/carrera-prod/n01/namesvr/bin/cleancache.v1.sh b/carrera-prod/n01/namesvr/bin/cleancache.v1.sh new file mode 100755 index 0000000..b334841 --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/cleancache.v1.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=$PATH:/sbin + +# +# GB +# +function changeFreeCache() +{ + EXTRA=$1 + MIN=$2 + sysctl -w vm.extra_free_kbytes=${EXTRA}000000 + sysctl -w vm.min_free_kbytes=${MIN}000000 +} + + +if [ $# -ne 1 ] +then + echo "Usage: $0 freecache(GB)" + echo "Example: $0 15" + exit +fi + +changeFreeCache 3 $1 +changeFreeCache 3 1 diff --git a/carrera-prod/n01/namesvr/bin/mqadmin b/carrera-prod/n01/namesvr/bin/mqadmin new file mode 100755 index 0000000..cd0253b --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/mqadmin @@ -0,0 +1,45 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +sh ${ROCKETMQ_HOME}/bin/tools.sh org.apache.rocketmq.tools.command.MQAdminStartup $@ diff --git a/carrera-prod/n01/namesvr/bin/mqadmin.cmd b/carrera-prod/n01/namesvr/bin/mqadmin.cmd new file mode 100755 index 0000000..4e061f0 --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/mqadmin.cmd @@ -0,0 +1,18 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%ROCKETMQ_HOME%\bin\tools.cmd" echo Please set the ROCKETMQ_HOME variable in your environment! & EXIT /B 1 +call "%ROCKETMQ_HOME%\bin\tools.cmd" org.apache.rocketmq.tools.command.MQAdminStartup %* \ No newline at end of file diff --git a/carrera-prod/n01/namesvr/bin/mqadmin.xml b/carrera-prod/n01/namesvr/bin/mqadmin.xml new file mode 100755 index 0000000..0f07da4 --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/mqadmin.xml @@ -0,0 +1,43 @@ + + + + false + + ${JAVA_HOME} + + server + + org.apache.rocketmq.tools.command.MQAdminStartup + + + ${cpd}/../lib + ${cpd}/.. + + + + + + + <-Xms512m> + <-Xmx1g> + <-XX:NewSize>256M + <-XX:MaxNewSize>512M + <-XX:PermSize>128M + <-XX:MaxPermSize>128M + + diff --git a/carrera-prod/n01/namesvr/bin/mqbroker b/carrera-prod/n01/namesvr/bin/mqbroker new file mode 100755 index 0000000..6a79c39 --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/mqbroker @@ -0,0 +1,45 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +sh ${ROCKETMQ_HOME}/bin/runbroker.sh org.apache.rocketmq.broker.BrokerStartup $@ diff --git a/carrera-prod/n01/namesvr/bin/mqbroker.cmd b/carrera-prod/n01/namesvr/bin/mqbroker.cmd new file mode 100755 index 0000000..3efb475 --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/mqbroker.cmd @@ -0,0 +1,23 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%ROCKETMQ_HOME%\bin\runbroker.cmd" echo Please set the ROCKETMQ_HOME variable in your environment! & EXIT /B 1 + +call "%ROCKETMQ_HOME%\bin\runbroker.cmd" org.apache.rocketmq.broker.BrokerStartup %* + +IF %ERRORLEVEL% EQU 0 ( + ECHO "Broker starts OK" +) \ No newline at end of file diff --git a/carrera-prod/n01/namesvr/bin/mqbroker.numanode0 b/carrera-prod/n01/namesvr/bin/mqbroker.numanode0 new file mode 100755 index 0000000..b7486a7 --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/mqbroker.numanode0 @@ -0,0 +1,47 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +export RMQ_NUMA_NODE=0 + +sh ${ROCKETMQ_HOME}/bin/mqbroker $@ diff --git a/carrera-prod/n01/namesvr/bin/mqbroker.numanode1 b/carrera-prod/n01/namesvr/bin/mqbroker.numanode1 new file mode 100755 index 0000000..c301fed --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/mqbroker.numanode1 @@ -0,0 +1,47 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +export RMQ_NUMA_NODE=1 + +sh ${ROCKETMQ_HOME}/bin/mqbroker $@ diff --git a/carrera-prod/n01/namesvr/bin/mqbroker.numanode2 b/carrera-prod/n01/namesvr/bin/mqbroker.numanode2 new file mode 100755 index 0000000..ea95304 --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/mqbroker.numanode2 @@ -0,0 +1,47 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +export RMQ_NUMA_NODE=2 + +sh ${ROCKETMQ_HOME}/bin/mqbroker $@ diff --git a/carrera-prod/n01/namesvr/bin/mqbroker.numanode3 b/carrera-prod/n01/namesvr/bin/mqbroker.numanode3 new file mode 100755 index 0000000..25d3d1d --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/mqbroker.numanode3 @@ -0,0 +1,47 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +export RMQ_NUMA_NODE=3 + +sh ${ROCKETMQ_HOME}/bin/mqbroker $@ diff --git a/carrera-prod/n01/namesvr/bin/mqbroker.xml b/carrera-prod/n01/namesvr/bin/mqbroker.xml new file mode 100755 index 0000000..3043cc0 --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/mqbroker.xml @@ -0,0 +1,45 @@ + + + + false + + ${JAVA_HOME} + + server + + org.apache.rocketmq.broker.BrokerStartup + + + ${cpd}/../lib + ${cpd}/.. + + + + + + + <-Xms512m> + + <-Xmx1g> + +<-XX:NewSize>256M +<-XX:MaxNewSize>512M +<-XX:PermSize>128M +<-XX:MaxPermSize>128M + + diff --git a/carrera-prod/n01/namesvr/bin/mqfiltersrv b/carrera-prod/n01/namesvr/bin/mqfiltersrv new file mode 100755 index 0000000..2fd0cbe --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/mqfiltersrv @@ -0,0 +1,45 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +sh ${ROCKETMQ_HOME}/bin/runserver.sh org.apache.rocketmq.filtersrv.FiltersrvStartup $@ diff --git a/carrera-prod/n01/namesvr/bin/mqfiltersrv.cmd b/carrera-prod/n01/namesvr/bin/mqfiltersrv.cmd new file mode 100755 index 0000000..0503026 --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/mqfiltersrv.cmd @@ -0,0 +1,23 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%ROCKETMQ_HOME%\bin\runbroker.cmd" echo Please set the ROCKETMQ_HOME variable in your environment! & EXIT /B 1 + +call "%ROCKETMQ_HOME%\bin\runserver.cmd" org.apache.rocketmq.filtersrv.FiltersrvStartup %* + +IF %ERRORLEVEL% EQU 0 ( + ECHO "Filtersrv starts OK" +) \ No newline at end of file diff --git a/carrera-prod/n01/namesvr/bin/mqfiltersrv.xml b/carrera-prod/n01/namesvr/bin/mqfiltersrv.xml new file mode 100755 index 0000000..dc36a8d --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/mqfiltersrv.xml @@ -0,0 +1,45 @@ + + + + false + + ${JAVA_HOME} + + server + + org.apache.rocketmq.filtersrv.FiltersrvStartup + + + ${cpd}/../lib + ${cpd}/.. + + + + + + + <-Xms512m> + + <-Xmx1g> + +<-XX:NewSize>256M +<-XX:MaxNewSize>512M +<-XX:PermSize>128M +<-XX:MaxPermSize>128M + + diff --git a/carrera-prod/n01/namesvr/bin/mqnamesrv b/carrera-prod/n01/namesvr/bin/mqnamesrv new file mode 100755 index 0000000..c1e70bd --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/mqnamesrv @@ -0,0 +1,45 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +sh ${ROCKETMQ_HOME}/bin/runserver.sh org.apache.rocketmq.namesrv.NamesrvStartup $@ diff --git a/carrera-prod/n01/namesvr/bin/mqnamesrv.cmd b/carrera-prod/n01/namesvr/bin/mqnamesrv.cmd new file mode 100755 index 0000000..2828bdc --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/mqnamesrv.cmd @@ -0,0 +1,23 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%ROCKETMQ_HOME%\bin\runserver.cmd" echo Please set the ROCKETMQ_HOME variable in your environment! & EXIT /B 1 + +call "%ROCKETMQ_HOME%\bin\runserver.cmd" org.apache.rocketmq.namesrv.NamesrvStartup %* + +IF %ERRORLEVEL% EQU 0 ( + ECHO "Namesrv starts OK" +) \ No newline at end of file diff --git a/carrera-prod/n01/namesvr/bin/mqnamesrv.xml b/carrera-prod/n01/namesvr/bin/mqnamesrv.xml new file mode 100755 index 0000000..1f050d1 --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/mqnamesrv.xml @@ -0,0 +1,45 @@ + + + + false + + ${JAVA_HOME} + + server + + org.apache.rocketmq.namesrv.NamesrvStartup + + + ${cpd}/../lib + ${cpd}/.. + + + + + + + <-Xms512m> + + <-Xmx1g> + +<-XX:NewSize>256M +<-XX:MaxNewSize>512M +<-XX:PermSize>128M +<-XX:MaxPermSize>128M + + diff --git a/carrera-prod/n01/namesvr/bin/mqshutdown b/carrera-prod/n01/namesvr/bin/mqshutdown new file mode 100755 index 0000000..d2d51fc --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/mqshutdown @@ -0,0 +1,49 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +case $1 in + broker) + + pid=`ps ax | grep -i 'org.apache.rocketmq.broker.BrokerStartup' |grep java | grep -v grep | awk '{print $1}'` + if [ -z "$pid" ] ; then + echo "No mqbroker running." + exit -1; + fi + + echo "The mqbroker(${pid}) is running..." + + kill ${pid} + + echo "Send shutdown request to mqbroker(${pid}) OK" + ;; + namesrv) + + pid=`ps ax | grep -i 'org.apache.rocketmq.namesrv.NamesrvStartup' |grep java | grep -v grep | awk '{print $1}'` + if [ -z "$pid" ] ; then + echo "No mqnamesrv running." + exit -1; + fi + + echo "The mqnamesrv(${pid}) is running..." + + kill ${pid} + + echo "Send shutdown request to mqnamesrv(${pid}) OK" + ;; + *) + echo "Useage: mqshutdown broker | namesrv" +esac diff --git a/carrera-prod/n01/namesvr/bin/mqshutdown.cmd b/carrera-prod/n01/namesvr/bin/mqshutdown.cmd new file mode 100755 index 0000000..50af026 --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/mqshutdown.cmd @@ -0,0 +1,35 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%JAVA_HOME%\bin\jps.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! & EXIT /B 1 + +setlocal + +set "PATH=%JAVA_HOME%\bin;%PATH%" + +if /I "%1" == "broker" ( + echo killing broker + for /f "tokens=1" %%i in ('jps -m ^| find "BrokerStartup"') do ( taskkill /F /PID %%i ) + echo Done! +) else if /I "%1" == "namesrv" ( + echo killing name server + + for /f "tokens=1" %%i in ('jps -m ^| find "NamesrvStartup"') do ( taskkill /F /PID %%i ) + + echo Done! +) else ( + echo Unknown role to kill, please specify broker or namesrv +) \ No newline at end of file diff --git a/carrera-prod/n01/namesvr/bin/os.sh b/carrera-prod/n01/namesvr/bin/os.sh new file mode 100755 index 0000000..cb5cf05 --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/os.sh @@ -0,0 +1,67 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=$PATH:/sbin + +HOME="/home/xiaoju" +if [ -d ${HOME}/tmpfs ] ; then + echo "tmpfs exist, do nothing." +else + ln -s /dev/shm ${HOME}/tmpfs + echo "create tmpfs ok" +fi + +# sudo sysctl -w vm.extra_free_kbytes=2000000 +# sudo sysctl -w vm.min_free_kbytes=1000000 +sudo sysctl -w vm.overcommit_memory=1 +sudo sysctl -w vm.drop_caches=1 +sudo sysctl -w vm.zone_reclaim_mode=0 +sudo sysctl -w vm.max_map_count=655360 +sudo sysctl -w vm.dirty_background_ratio=50 +sudo sysctl -w vm.dirty_ratio=50 +sudo sysctl -w vm.dirty_writeback_centisecs=360000 +sudo sysctl -w vm.page-cluster=3 +sudo sysctl -w vm.swappiness=1 + +echo 'ulimit -n 655350' >> /etc/profile +echo '* hard nofile 655350' >> /etc/security/limits.conf + +echo '* hard memlock unlimited' >> /etc/security/limits.conf +echo '* soft memlock unlimited' >> /etc/security/limits.conf + +DISK=`df -k | sort -n -r -k 2 | awk -F/ 'NR==1 {gsub(/[0-9].*/,"",$3); print $3}'` +[ "$DISK" = 'cciss' ] && DISK='cciss!c0d0' +echo 'deadline' > /sys/block/${DISK}/queue/scheduler + + +echo "---------------------------------------------------------------" +sysctl vm.extra_free_kbytes +sysctl vm.min_free_kbytes +sysctl vm.overcommit_memory +sysctl vm.drop_caches +sysctl vm.zone_reclaim_mode +sysctl vm.max_map_count +sysctl vm.dirty_background_ratio +sysctl vm.dirty_ratio +sysctl vm.dirty_writeback_centisecs +sysctl vm.page-cluster +sysctl vm.swappiness + +#su - admin -c 'ulimit -n' +ulimit -n +cat /sys/block/$DISK/queue/scheduler + diff --git a/carrera-prod/n01/namesvr/bin/play.cmd b/carrera-prod/n01/namesvr/bin/play.cmd new file mode 100755 index 0000000..f1737d5 --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/play.cmd @@ -0,0 +1,30 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +START /B mqnamesrv > ns.log 2>&1 +IF %ERRORLEVEL% NEQ 0 ( + echo "Failed to start name server. Please check ns.log" + EXIT /B 1 +) + +START /B mqbroker -n localhost:9876 > bk.log 2>&1 + +IF %ERRORLEVEL% NEQ 0 ( + ECHO "Failed to start broker. Please check bk.log" + EXIT /B 1 +) + +echo "Start Name Server and Broker Successfully." \ No newline at end of file diff --git a/carrera-prod/n01/namesvr/bin/play.sh b/carrera-prod/n01/namesvr/bin/play.sh new file mode 100755 index 0000000..359d18d --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/play.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Name Server +# +nohup sh mqnamesrv > ns.log 2>&1 & + +# +# Service Addr +# +ADDR=`hostname -i`:9876 + +# +# Broker +# +nohup sh mqbroker -n ${ADDR} > bk.log 2>&1 & + +echo "Start Name Server and Broker Successfully, ${ADDR}" diff --git a/carrera-prod/n01/namesvr/bin/runbroker b/carrera-prod/n01/namesvr/bin/runbroker new file mode 100755 index 0000000..538f8e1 --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/runbroker @@ -0,0 +1,15 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. diff --git a/carrera-prod/n01/namesvr/bin/runbroker.cmd b/carrera-prod/n01/namesvr/bin/runbroker.cmd new file mode 100755 index 0000000..eab7e30 --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/runbroker.cmd @@ -0,0 +1,42 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%JAVA_HOME%\bin\java.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! & EXIT /B 1 +set "JAVA=%JAVA_HOME%\bin\java.exe" + +setlocal + +set BASE_DIR=%~dp0 +set BASE_DIR=%BASE_DIR:~0,-1% +for %%d in (%BASE_DIR%) do set BASE_DIR=%%~dpd + +set CLASSPATH=.;%BASE_DIR%conf;%CLASSPATH% + +rem =========================================================================================== +rem JVM Configuration +rem =========================================================================================== +set "JAVA_OPT=%JAVA_OPT% -server -Xms2g -Xmx2g -Xmn1g" +set "JAVA_OPT=%JAVA_OPT% -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0 -XX:SurvivorRatio=8" +set "JAVA_OPT=%JAVA_OPT% -verbose:gc -Xloggc:%USERPROFILE%\mq_gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintAdaptiveSizePolicy" +set "JAVA_OPT=%JAVA_OPT% -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=30m" +set "JAVA_OPT=%JAVA_OPT% -XX:-OmitStackTraceInFastThrow" +set "JAVA_OPT=%JAVA_OPT% -XX:+AlwaysPreTouch" +set "JAVA_OPT=%JAVA_OPT% -XX:MaxDirectMemorySize=15g" +set "JAVA_OPT=%JAVA_OPT% -XX:-UseLargePages -XX:-UseBiasedLocking" +set "JAVA_OPT=%JAVA_OPT% -Djava.ext.dirs=%BASE_DIR%lib" +set "JAVA_OPT=%JAVA_OPT% -cp %CLASSPATH%" + +"%JAVA%" %JAVA_OPT% %* \ No newline at end of file diff --git a/carrera-prod/n01/namesvr/bin/runbroker.sh b/carrera-prod/n01/namesvr/bin/runbroker.sh new file mode 100755 index 0000000..6898875 --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/runbroker.sh @@ -0,0 +1,61 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#=========================================================================================== +# Java Environment Setting +#=========================================================================================== +error_exit () +{ + echo "ERROR: $1 !!" + exit 1 +} + +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java +[ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)!" + +export JAVA_HOME +export JAVA="$JAVA_HOME/bin/java" +export BASE_DIR=$(dirname $0)/.. +export CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH} + +#=========================================================================================== +# JVM Configuration +#=========================================================================================== +JAVA_OPT="${JAVA_OPT} -server -Xms512m -Xmx512m -Xmn512m" +JAVA_OPT="${JAVA_OPT} -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0 -XX:SurvivorRatio=8" +JAVA_OPT="${JAVA_OPT} -verbose:gc -Xloggc:/dev/shm/mq_gc_%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintAdaptiveSizePolicy" +JAVA_OPT="${JAVA_OPT} -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=30m" +JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow" +JAVA_OPT="${JAVA_OPT} -XX:+AlwaysPreTouch" +JAVA_OPT="${JAVA_OPT} -XX:MaxDirectMemorySize=512m" +JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages -XX:-UseBiasedLocking" +JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${BASE_DIR}/lib" +JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}" +JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}" + +numactl --interleave=all pwd > /dev/null 2>&1 +if [ $? -eq 0 ] +then + if [ -z "$RMQ_NUMA_NODE" ] ; then + numactl --interleave=all $JAVA ${JAVA_OPT} $@ + else + numactl --cpunodebind=$RMQ_NUMA_NODE --membind=$RMQ_NUMA_NODE $JAVA ${JAVA_OPT} $@ + fi +else + $JAVA ${JAVA_OPT} $@ +fi diff --git a/carrera-prod/n01/namesvr/bin/runserver.cmd b/carrera-prod/n01/namesvr/bin/runserver.cmd new file mode 100755 index 0000000..48e32bf --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/runserver.cmd @@ -0,0 +1,37 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + + +if not exist "%JAVA_HOME%\bin\java.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! & EXIT /B 1 +set "JAVA=%JAVA_HOME%\bin\java.exe" + +setlocal + +set BASE_DIR=%~dp0 +set BASE_DIR=%BASE_DIR:~0,-1% +for %%d in (%BASE_DIR%) do set BASE_DIR=%%~dpd + +set CLASSPATH=.;%BASE_DIR%conf;%CLASSPATH% + +set "JAVA_OPT=%JAVA_OPT% -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m" +set "JAVA_OPT=%JAVA_OPT% -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 -XX:-UseParNewGC" +set "JAVA_OPT=%JAVA_OPT% -verbose:gc -Xloggc:"%USERPROFILE%\rmq_srv_gc.log" -XX:+PrintGCDetails" +set "JAVA_OPT=%JAVA_OPT% -XX:-OmitStackTraceInFastThrow" +set "JAVA_OPT=%JAVA_OPT% -XX:-UseLargePages" +set "JAVA_OPT=%JAVA_OPT% -Djava.ext.dirs=%BASE_DIR%lib" +set "JAVA_OPT=%JAVA_OPT% -cp "%CLASSPATH%"" + +"%JAVA%" %JAVA_OPT% %* \ No newline at end of file diff --git a/carrera-prod/n01/namesvr/bin/runserver.sh b/carrera-prod/n01/namesvr/bin/runserver.sh new file mode 100755 index 0000000..c5b9aad --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/runserver.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#=========================================================================================== +# Java Environment Setting +#=========================================================================================== +error_exit () +{ + echo "ERROR: $1 !!" + exit 1 +} + +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java +[ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)!" + +export JAVA_HOME +export JAVA="$JAVA_HOME/bin/java" +export BASE_DIR=$(dirname $0)/.. +export CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH} + +#=========================================================================================== +# JVM Configuration +#=========================================================================================== +JAVA_OPT="${JAVA_OPT} -server -Xms128m -Xmx128m -Xmn128m -XX:MetaspaceSize=32m -XX:MaxMetaspaceSize=32m" +JAVA_OPT="${JAVA_OPT} -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 -XX:-UseParNewGC" +JAVA_OPT="${JAVA_OPT} -verbose:gc -Xloggc:/dev/shm/rmq_srv_gc.log -XX:+PrintGCDetails" +JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow" +JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages" +JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${BASE_DIR}/lib" +#JAVA_OPT="${JAVA_OPT} -Xdebug -Xrunjdwp:transport=dt_socket,address=9555,server=y,suspend=n" +JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}" +JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}" + +$JAVA ${JAVA_OPT} $@ diff --git a/carrera-prod/n01/namesvr/bin/setcache.sh b/carrera-prod/n01/namesvr/bin/setcache.sh new file mode 100755 index 0000000..27633f3 --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/setcache.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=$PATH:/sbin + +# +# GB +# +function changeFreeCache() +{ + EXTRA=$1 + MIN=$2 + sysctl -w vm.extra_free_kbytes=${EXTRA}000000 + sysctl -w vm.min_free_kbytes=${MIN}000000 + sysctl -w vm.swappiness=0 +} + + +if [ $# -ne 2 ] +then + echo "Usage: $0 extra_free_kbytes(GB) min_free_kbytes(GB)" + echo "Example: $0 3 1" + exit +fi + +changeFreeCache $1 $2 diff --git a/carrera-prod/n01/namesvr/bin/startfsrv.sh b/carrera-prod/n01/namesvr/bin/startfsrv.sh new file mode 100755 index 0000000..f7ba188 --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/startfsrv.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +nohup sh ${ROCKETMQ_HOME}/bin/runserver.sh org.apache.rocketmq.filtersrv.FiltersrvStartup $@ & diff --git a/carrera-prod/n01/namesvr/bin/tools.cmd b/carrera-prod/n01/namesvr/bin/tools.cmd new file mode 100755 index 0000000..28ce765 --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/tools.cmd @@ -0,0 +1,35 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%JAVA_HOME%\bin\java.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! & EXIT /B 1 + +set "JAVA=%JAVA_HOME%\bin\java.exe" + +setlocal +set BASE_DIR=%~dp0 +set BASE_DIR=%BASE_DIR:~0,-1% +for %%d in (%BASE_DIR%) do set BASE_DIR=%%~dpd + +set CLASSPATH=.;%BASE_DIR%conf;%CLASSPATH% + +rem =========================================================================================== +rem JVM Configuration +rem =========================================================================================== +set "JAVA_OPT=%JAVA_OPT% -server -Xms1g -Xmx1g -Xmn256m -XX:PermSize=128m -XX:MaxPermSize=128m" +set "JAVA_OPT=%JAVA_OPT% -Djava.ext.dirs="%BASE_DIR%\lib";"%JAVA_HOME%\jre\lib\ext"" +set "JAVA_OPT=%JAVA_OPT% -cp "%CLASSPATH%"" + +"%JAVA%" %JAVA_OPT% %* \ No newline at end of file diff --git a/carrera-prod/n01/namesvr/bin/tools.sh b/carrera-prod/n01/namesvr/bin/tools.sh new file mode 100755 index 0000000..e0c840c --- /dev/null +++ b/carrera-prod/n01/namesvr/bin/tools.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#=========================================================================================== +# Java Environment Setting +#=========================================================================================== +error_exit () +{ + echo "ERROR: $1 !!" + exit 1 +} + +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java +[ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)!" + +export JAVA_HOME +export JAVA="$JAVA_HOME/bin/java" +export BASE_DIR=$(dirname $0)/.. +export CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH} + +#=========================================================================================== +# JVM Configuration +#=========================================================================================== +JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn256m" +JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${BASE_DIR}/lib:${JAVA_HOME}/jre/lib/ext" +JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}" + +$JAVA ${JAVA_OPT} $@ diff --git a/carrera-prod/n01/namesvr/conf/logback_broker.xml b/carrera-prod/n01/namesvr/conf/logback_broker.xml new file mode 100644 index 0000000..d15c205 --- /dev/null +++ b/carrera-prod/n01/namesvr/conf/logback_broker.xml @@ -0,0 +1,337 @@ + + + + + + ${user.home}/logs/rocketmqlogs/broker_default.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/broker_default.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + ${user.home}/logs/rocketmqlogs/broker.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/broker.%i.log.gz + 1 + 20 + + + 128MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/protection.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/protection.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/watermark.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/watermark.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/store.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/store.%i.log.gz + 1 + 10 + + + 128MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/remoting.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/remoting.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/storeerror.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/storeerror.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + + ${user.home}/logs/rocketmqlogs/transaction.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/transaction.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/lock.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/lock.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/filter.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/filter.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/stats.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/stats.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p - %m%n + UTF-8 + + + + + ${user.home}/logs/rocketmqlogs/commercial.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/commercial.%i.log.gz + 1 + 10 + + + 500MB + + + + + true + + %d{yyy-MM-dd HH\:mm\:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n01/namesvr/conf/logback_filtersrv.xml b/carrera-prod/n01/namesvr/conf/logback_filtersrv.xml new file mode 100644 index 0000000..71b9a93 --- /dev/null +++ b/carrera-prod/n01/namesvr/conf/logback_filtersrv.xml @@ -0,0 +1,87 @@ + + + + + + ${user.home}/logs/rocketmqlogs/filtersrv_default.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/filtersrv_default.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + ${user.home}/logs/rocketmqlogs/filtersrv.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/filtersrv.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + 0 + + + + true + + %d{yyy-MM-dd HH\:mm\:ss,SSS} %p %t - %m%n + UTF-8 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n01/namesvr/conf/logback_namesrv.xml b/carrera-prod/n01/namesvr/conf/logback_namesrv.xml new file mode 100644 index 0000000..c68c8b6 --- /dev/null +++ b/carrera-prod/n01/namesvr/conf/logback_namesrv.xml @@ -0,0 +1,89 @@ + + + + + + ${user.home}/logs/rocketmqlogs/namesrv_default.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/namesrv_default.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + ${user.home}/logs/rocketmqlogs/namesrv.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/namesrv.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + 0 + + + + true + + %d{yyy-MM-dd HH\:mm\:ss,SSS} %p %t - %m%n + UTF-8 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n01/namesvr/conf/logback_tools.xml b/carrera-prod/n01/namesvr/conf/logback_tools.xml new file mode 100644 index 0000000..28283ad --- /dev/null +++ b/carrera-prod/n01/namesvr/conf/logback_tools.xml @@ -0,0 +1,93 @@ + + + + + + ${user.home}/logs/rocketmqlogs/tools_default.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/tools_default.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + ${user.home}/logs/rocketmqlogs/tools.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/tools.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + + true + + %d{yyy-MM-dd HH\:mm\:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n01/namesvr/control.sh b/carrera-prod/n01/namesvr/control.sh new file mode 100755 index 0000000..d3a5d29 --- /dev/null +++ b/carrera-prod/n01/namesvr/control.sh @@ -0,0 +1,76 @@ +#!/bin/bash + +MAIN_CLASS=rocketmq.namesrv.NamesrvStartup + +function get_pid() { + PID=$(ps ax | grep -i ${MAIN_CLASS} |grep java | grep -v grep | awk '{print $1}') +} + +function start() { + get_pid + if [ ! -z "$PID" ] ; then + echo "Shutdown old process($MAIN_CLASS) first, pid=${PID}" + exit 1 + fi + + nohup sh bin/mqnamesrv >> ns.log 2>&1 & + echo "running: nohup sh bin/mqnamesrv >> ns.log 2>&1 &" + + get_pid + t=0 + while [[ -z ${PID} && "$t" -lt 10 ]]; do + echo "time=$t,starting process($MAIN_CLASS)" + get_pid + t=$(($t+1)) + sleep 0.5 + done + + if [ -z ${PID} ]; then + echo "start process($MAIN_CLASS) failed!!!" + exit 1 + else + echo "start process($MAIN_CLASS) success, pid=${PID}" + fi +} + +function stop() { + get_pid + if [ -z "$PID" ] ; then + echo "no process running..." + else + echo "killing process($MAIN_CLASS), pid=${PID}" + kill ${PID} + fi + + t=0 + while [[ ! -z ${PID} && "$t" -lt 60 ]]; do + echo "time=$t,killing process($MAIN_CLASS), pid=${PID}" + get_pid + t=$(($t+1)) + sleep 1 + done + + if [ ! -z ${PID} ]; then + echo "killing process($MAIN_CLASS), pid=${PID}" + exit 1 + fi +} + +workspace=$(cd $(dirname $0) && pwd -P) +cd ${workspace} + +case "$1" in + "start") + start + ;; + "stop") + stop + ;; + "reload") + stop + start + ;; + *) + echo "supporting cmd: start/stop/reload" + ;; +esac diff --git a/carrera-prod/n01/producer/conf/carrera.yaml b/carrera-prod/n01/producer/conf/carrera.yaml new file mode 100644 index 0000000..8669a8e --- /dev/null +++ b/carrera-prod/n01/producer/conf/carrera.yaml @@ -0,0 +1,3 @@ +zookeeperAddr: 172.18.0.3:2181/carrera/v4/config # config zk cluster address here. +host: 172.18.0.3 # local ip +port: 9613 # thrift server port. diff --git a/carrera-prod/n01/producer/conf/log4j2.xml b/carrera-prod/n01/producer/conf/log4j2.xml new file mode 100644 index 0000000..fd35d3e --- /dev/null +++ b/carrera-prod/n01/producer/conf/log4j2.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n01/producer/control.sh b/carrera-prod/n01/producer/control.sh new file mode 100755 index 0000000..430e628 --- /dev/null +++ b/carrera-prod/n01/producer/control.sh @@ -0,0 +1,106 @@ +#!/bin/bash +MAINCLASS=com.xiaojukeji.carrera.pproxy.proxy.ProducerProxyMain +PROXY_VERSION=1.0.0-SNAPSHOT +CONTROL_LOG="logs/control.log" + +function start() { + OLD_PID="`pgrep -f ${MAINCLASS}`" + if [ "$OLD_PID" ]; then + echo "Proxy is already running, pid=$OLD_PID. Stop it first!" + exit 1 + fi + + BASEDIR=$(dirname "$0") + cd "${BASEDIR}" + PROXY_HOME=`pwd` + mkdir -p logs/old + + CARRERA_CONFIG="${PROXY_HOME}/conf/carrera.yaml" + + # backup log + LOG_NAMES=(carrera.log drop.log error.log metric.log gc.log rocketmq.log) + LOG_SUFFIX=$(date +%Y%m%d-%H%M%S) + for var in ${LOG_NAMES[@]}; + do + if [ -f "${PROXY_HOME}/logs/${var}" ]; then + mv "${PROXY_HOME}/logs/${var}" "${PROXY_HOME}/logs/old/${var}.${LOG_SUFFIX}" + fi + done + + # set config + LOG_CARRERA_LEVEL="INFO" + LOG_BATCH_LEVEL="INFO" + MEM_OPTS="-Xms256m -Xmx256m -Xmn256m" + LOG_SAVE_SIZE="1G" + LOG_SAVE_TIME="7d" + + export LOG_SAVE_SIZE + export LOG_SAVE_TIME + export LOG_CARRERA_LEVEL + export LOG_BATCH_LEVEL + + echo "MEM_OPTS: " ${MEM_OPTS} + echo "LOG_SAVE_SIZE="$LOG_SAVE_SIZE", LOG_SAVE_TIME="$LOG_SAVE_TIME", LOG_CARRERA_LEVEL="$LOG_CARRERA_LEVEL", LOG_BATCH_LEVEL="$LOG_BATCH_LEVEL + + JVM_OPTS="${MEM_OPTS} ${JVM_OPTS} " + JVM_OPTS="${JVM_OPTS} -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=50 -XX:+UseCMSInitiatingOccupancyOnly" + JVM_OPTS="${JVM_OPTS} -XX:+PreserveFramePointer -XX:-UseBiasedLocking -XX:-OmitStackTraceInFastThrow" + JVM_OPTS="${JVM_OPTS} -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:${PROXY_HOME}/logs/gc.log" + JVM_OPTS="${JVM_OPTS} -XX:+PrintSafepointStatistics" + + JAVA_OPTS="${JAVA_OPTS} -Dlog4j.configurationFile=file://${PROXY_HOME}/conf/log4j2.xml" + JAVA_OPTS="${JAVA_OPTS} -Drocketmq.client.log.loadconfig=false" + JAVA_OPTS="${JAVA_OPTS} -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector" + + CLASSPATH="${PROXY_HOME}/carrera-producer-${PROXY_VERSION}-jar-with-dependencies.jar":${CLASSPATH} + + CONSOLE_LOG=${PROXY_HOME}/logs/console.`date +%Y-%m-%d`.log + date >> ${CONSOLE_LOG} + + java ${JVM_OPTS} ${JAVA_OPTS} -cp ${CLASSPATH} ${MAINCLASS} ${CARRERA_CONFIG} >> ${CONSOLE_LOG} 2>&1 & + sleep 2 + date >> ${CONTROL_LOG} + PID="`pgrep -f ${MAINCLASS}`" + if [ "$PID" ]; then + echo "New Proxy is running, pid=$PID" >> ${CONTROL_LOG} + else + echo "Start Proxy Failed" >> ${CONTROL_LOG} + exit 1 + fi +} + +function stop() { + mkdir -p logs + date >> logs/control.log + echo "Killing Proxy =`pgrep -f ${MAINCLASS}`" >> ${CONTROL_LOG} + pkill -15 -f ${MAINCLASS} + t=0 + while [[ `pgrep -f ${MAINCLASS}` && "$t" -lt 60 ]]; do + echo "time=$t,killing `pgrep -f ${MAINCLASS}`" + t=$(($t+1)) + sleep 1 + done + if [ `pgrep -f ${MAINCLASS}` ]; then + echo "Stop Proxy Failed" >> ${CONTROL_LOG} + exit 1 + fi + echo "KILLED" >> ${CONTROL_LOG} +} + + +case "$1" in + "start") + start + ;; + "stop") + stop + ;; + "reload") + stop + start + ;; + *) + echo "supporting cmd: start/stop/reload" + ;; +esac + diff --git a/carrera-prod/n01/start.sh b/carrera-prod/n01/start.sh new file mode 100644 index 0000000..83af74b --- /dev/null +++ b/carrera-prod/n01/start.sh @@ -0,0 +1,16 @@ + +sh /root/zookeeper/bin/zkServer.sh start +cd /root/console && sh ./control.sh start + +while ! nc -z localhost 8080; do + sleep 0.1 +done + +curl http://localhost:8080/carrera/api/odin/internal/v4/initZkPath +curl http://localhost:8080/carrera/api/odin/internal/v4/initAllZk + +cd /root/namesvr && sh ./control.sh start +cd /root/broker && sh ./control.sh start + +cd /root/consumer && sh ./control.sh start +cd /root/producer && sh ./control.sh start \ No newline at end of file diff --git a/carrera-prod/n01/stop.sh b/carrera-prod/n01/stop.sh new file mode 100644 index 0000000..8ddb64a --- /dev/null +++ b/carrera-prod/n01/stop.sh @@ -0,0 +1,9 @@ + +sh /root/zookeeper/bin/zkServer.sh stop +cd /root/console && sh ./control.sh stop + +cd /root/namesvr && sh ./control.sh stop +cd /root/broker && sh ./control.sh stop + +cd /root/consumer && sh ./control.sh stop +cd /root/producer && sh ./control.sh stop \ No newline at end of file diff --git a/carrera-prod/n02/Dockerfile b/carrera-prod/n02/Dockerfile new file mode 100644 index 0000000..72df11a --- /dev/null +++ b/carrera-prod/n02/Dockerfile @@ -0,0 +1,57 @@ +FROM centos:7 + +## Ports +EXPOSE 9613 +EXPOSE 9713 +EXPOSE 8080 +EXPOSE 2181 + +# Env +ENV HOME_DIR /root +ENV HOME /root + +WORKDIR ${HOME_DIR} + +RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ + && echo 'Asia/Shanghai' >/etc/timezone + +RUN yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel unzip gettext nmap-ncat openssl wget telnet\ + && yum clean all -y + +RUN curl http://mirror.bit.edu.cn/apache/tomcat/tomcat-9/v9.0.24/bin/apache-tomcat-9.0.24.zip -o tomcat.zip \ + && unzip tomcat.zip \ + && mv apache-tomcat-9.0.24 tomcat \ + && rm tomcat.zip \ + && chmod +x tomcat/bin/*.sh + +RUN curl http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz -o zookeeper-3.4.10.tar.gz \ + && tar xzvf zookeeper-3.4.10.tar.gz \ + && mv zookeeper-3.4.10 zookeeper \ + && rm zookeeper-3.4.10.tar.gz \ + && cp zookeeper/conf/zoo_sample.cfg zookeeper/conf/zoo.cfg \ + && echo "dataDir=/root/zookeeper/data" >> zookeeper/conf/zoo.cfg \ + && echo "server.1=172.18.0.3:2888:3888" >> zookeeper/conf/zoo.cfg \ + && echo "server.2=172.18.0.4:2888:3888" >> zookeeper/conf/zoo.cfg \ + && echo "server.3=172.18.0.5:2888:3888" >> zookeeper/conf/zoo.cfg \ + && mkdir zookeeper/data \ + && echo '2' > zookeeper/data/myid + +RUN mkdir -p \ + /root/logs/rocketmqlogs \ + /root/chronos-storage/rocksdb \ + /root/chronos-storage/seektimestamp \ + /root/chronos-storage/rocksdb_backup \ + /root/chronos-storage/rocksdb_restore + +# copy +COPY console ${HOME_DIR}/console +COPY consumer ${HOME_DIR}/consumer +COPY producer ${HOME_DIR}/producer +COPY chronos ${HOME_DIR}/chronos +COPY broker ${HOME_DIR}/broker +COPY namesvr ${HOME_DIR}/namesvr +COPY start.sh ${HOME_DIR}/start.sh +COPY stop.sh ${HOME_DIR}/stop.sh + +# cmd +CMD bash -C '/root/start.sh';'bash' diff --git a/carrera-prod/n02/broker/LICENSE b/carrera-prod/n02/broker/LICENSE new file mode 100644 index 0000000..3726172 --- /dev/null +++ b/carrera-prod/n02/broker/LICENSE @@ -0,0 +1,334 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (properties) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +------ +This product has a bundle logback, which is available under the EPL v1.0 License. +The source code of logback can be found at https://github.com/qos-ch/logback. + +Logback LICENSE +--------------- + +Logback: the reliable, generic, fast and flexible logging framework. +Copyright (C) 1999-2015, QOS.ch. All rights reserved. + +This program and the accompanying materials are dual-licensed under +either the terms of the Eclipse Public License v1.0 as published by +the Eclipse Foundation + + or (per the licensee's choosing) + +under the terms of the GNU Lesser General Public License version 2.1 +as published by the Free Software Foundation. + +------ +This product has a bundle slf4j, which is available under the MIT License. +The source code of slf4j can be found at https://github.com/qos-ch/slf4j. + + Copyright (c) 2004-2017 QOS.ch + All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +------ +This product has a bundle fastjson, which is available under the ASL2 License. +The source code of fastjson can be found at https://github.com/alibaba/fastjson. + + Copyright 1999-2016 Alibaba Group Holding Ltd. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +------ +This product has a bundle javassist, which is available under the ASL2 License. +The source code of javassist can be found at https://github.com/jboss-javassist/javassist. + + Copyright (C) 1999- by Shigeru Chiba, All rights reserved. + + Javassist (JAVA programming ASSISTant) makes Java bytecode manipulation simple. + It is a class library for editing bytecodes in Java; it enables Java programs to define a new class + at runtime and to modify a class file when the JVM loads it. Unlike other similar bytecode editors, + Javassist provides two levels of API: source level and bytecode level. If the users use the source- level API, + they can edit a class file without knowledge of the specifications of the Java bytecode. + The whole API is designed with only the vocabulary of the Java language. + You can even specify inserted bytecode in the form of source text; Javassist compiles it on the fly. + On the other hand, the bytecode-level API allows the users to directly edit a class file as other editors. + + This software is distributed under the Mozilla Public License Version 1.1, + the GNU Lesser General Public License Version 2.1 or later, or the Apache License Version 2.0. + +------ +This product has a bundle jna, which is available under the ASL2 License. +The source code of jna can be found at https://github.com/java-native-access/jna. + + This copy of JNA is licensed under the + Apache (Software) License, version 2.0 ("the License"). + See the License for details about distribution rights, and the + specific rights regarding derivate works. + + You may obtain a copy of the License at: + + http://www.apache.org/licenses/ + + A copy is also included in the downloadable source code package + containing JNA, in file "AL2.0", under the same directory + as this file. +------ +This product has a bundle guava, which is available under the ASL2 License. +The source code of guava can be found at https://github.com/google/guava. + + Copyright (C) 2007 The Guava authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +------ +This product has a bundle OpenMessaging, which is available under the ASL2 License. +The source code of OpenMessaging can be found at https://github.com/openmessaging/openmessaging. + + Copyright (C) 2017 The OpenMessaging authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/carrera-prod/n02/broker/NOTICE b/carrera-prod/n02/broker/NOTICE new file mode 100644 index 0000000..c91dc22 --- /dev/null +++ b/carrera-prod/n02/broker/NOTICE @@ -0,0 +1,36 @@ +Apache RocketMQ +Copyright 2016-2017 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +------ +This product has a bundle netty: + The Netty Project + ================= + +Please visit the Netty web site for more information: + + * http://netty.io/ + +Copyright 2014 The Netty Project + +The Netty Project licenses this file to you under the Apache License, +version 2.0 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations +under the License. + +Also, please refer to each LICENSE..txt file, which is located in +the 'license' directory of the distribution file, for the license terms of the +components that this product depends on. + +------ +This product has a bundle commons-lang, which includes software from the Spring Framework, +under the Apache License 2.0 (see: StringUtils.containsWhitespace()) \ No newline at end of file diff --git a/carrera-prod/n02/broker/bin/README.md b/carrera-prod/n02/broker/bin/README.md new file mode 100755 index 0000000..efbb67d --- /dev/null +++ b/carrera-prod/n02/broker/bin/README.md @@ -0,0 +1,29 @@ +### Operating system tuning +Before deploying broker servers, it's highly recommended to run **os.sh**, which is to optimize your operating system for better performance. + +## Notice +### os.sh should be executed only once with root permission. +### os.sh parameter settings are for reference purpose only. You can tune them according to your target host configurations. + + +### Start broker +* Unix platform + + `nohup sh mqbroker &` + +### Shutdown broker + sh mqshutdown broker + +### Start Nameserver +* Unix platform + + `nohup sh mqnamesrv &` + +### Shutdown Nameserver + sh mqshutdown namesrv + +### Update or create Topic + sh mqadmin updateTopic -b 127.0.0.1:10911 -t TopicA + +### Update or create subscription group + sh mqadmin updateSubGroup -b 127.0.0.1:10911 -g SubGroupA \ No newline at end of file diff --git a/carrera-prod/n02/broker/bin/cachedog.sh b/carrera-prod/n02/broker/bin/cachedog.sh new file mode 100755 index 0000000..9329fdb --- /dev/null +++ b/carrera-prod/n02/broker/bin/cachedog.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=$PATH:/sbin + +while true; do + nr_free_pages=`fgrep -A 10 Normal /proc/zoneinfo |grep nr_free_pages |awk -F ' ' '{print $2}'` + high=`fgrep -A 10 Normal /proc/zoneinfo |grep high |awk -F ' ' '{print $2}'` + + NOW_DATE=`date +%D` + NOW_TIME=`date +%T` + + if [ ${nr_free_pages} -le ${high} ]; then + sysctl -w vm.drop_caches=3 + nr_free_pages_new=`fgrep -A 10 Normal /proc/zoneinfo |grep nr_free_pages |awk -F ' ' '{print $2}'` + + printf "%s %s [CLEAN] nr_free_pages < high, clean cache. nr_free_pages=%s ====> nr_free_pages=%s\n" "${NOW_DATE}" "${NOW_TIME}" ${nr_free_pages} ${nr_free_pages_new} + + sysctl -w vm.drop_caches=1 + echo + echo + echo + else + printf "%s %s [NOTHING] nr_free_pages=%s high=%s\n" "${NOW_DATE}" "${NOW_TIME}" ${nr_free_pages} ${high} + fi + + sleep 1 +done diff --git a/carrera-prod/n02/broker/bin/cleancache.sh b/carrera-prod/n02/broker/bin/cleancache.sh new file mode 100755 index 0000000..9c6e9ab --- /dev/null +++ b/carrera-prod/n02/broker/bin/cleancache.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=$PATH:/sbin + +sysctl -w vm.drop_caches=3 diff --git a/carrera-prod/n02/broker/bin/cleancache.v1.sh b/carrera-prod/n02/broker/bin/cleancache.v1.sh new file mode 100755 index 0000000..b334841 --- /dev/null +++ b/carrera-prod/n02/broker/bin/cleancache.v1.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=$PATH:/sbin + +# +# GB +# +function changeFreeCache() +{ + EXTRA=$1 + MIN=$2 + sysctl -w vm.extra_free_kbytes=${EXTRA}000000 + sysctl -w vm.min_free_kbytes=${MIN}000000 +} + + +if [ $# -ne 1 ] +then + echo "Usage: $0 freecache(GB)" + echo "Example: $0 15" + exit +fi + +changeFreeCache 3 $1 +changeFreeCache 3 1 diff --git a/carrera-prod/n02/broker/bin/mqadmin b/carrera-prod/n02/broker/bin/mqadmin new file mode 100755 index 0000000..cd0253b --- /dev/null +++ b/carrera-prod/n02/broker/bin/mqadmin @@ -0,0 +1,45 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +sh ${ROCKETMQ_HOME}/bin/tools.sh org.apache.rocketmq.tools.command.MQAdminStartup $@ diff --git a/carrera-prod/n02/broker/bin/mqadmin.cmd b/carrera-prod/n02/broker/bin/mqadmin.cmd new file mode 100755 index 0000000..4e061f0 --- /dev/null +++ b/carrera-prod/n02/broker/bin/mqadmin.cmd @@ -0,0 +1,18 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%ROCKETMQ_HOME%\bin\tools.cmd" echo Please set the ROCKETMQ_HOME variable in your environment! & EXIT /B 1 +call "%ROCKETMQ_HOME%\bin\tools.cmd" org.apache.rocketmq.tools.command.MQAdminStartup %* \ No newline at end of file diff --git a/carrera-prod/n02/broker/bin/mqadmin.xml b/carrera-prod/n02/broker/bin/mqadmin.xml new file mode 100755 index 0000000..0f07da4 --- /dev/null +++ b/carrera-prod/n02/broker/bin/mqadmin.xml @@ -0,0 +1,43 @@ + + + + false + + ${JAVA_HOME} + + server + + org.apache.rocketmq.tools.command.MQAdminStartup + + + ${cpd}/../lib + ${cpd}/.. + + + + + + + <-Xms512m> + <-Xmx1g> + <-XX:NewSize>256M + <-XX:MaxNewSize>512M + <-XX:PermSize>128M + <-XX:MaxPermSize>128M + + diff --git a/carrera-prod/n02/broker/bin/mqbroker b/carrera-prod/n02/broker/bin/mqbroker new file mode 100755 index 0000000..6a79c39 --- /dev/null +++ b/carrera-prod/n02/broker/bin/mqbroker @@ -0,0 +1,45 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +sh ${ROCKETMQ_HOME}/bin/runbroker.sh org.apache.rocketmq.broker.BrokerStartup $@ diff --git a/carrera-prod/n02/broker/bin/mqbroker.cmd b/carrera-prod/n02/broker/bin/mqbroker.cmd new file mode 100755 index 0000000..3efb475 --- /dev/null +++ b/carrera-prod/n02/broker/bin/mqbroker.cmd @@ -0,0 +1,23 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%ROCKETMQ_HOME%\bin\runbroker.cmd" echo Please set the ROCKETMQ_HOME variable in your environment! & EXIT /B 1 + +call "%ROCKETMQ_HOME%\bin\runbroker.cmd" org.apache.rocketmq.broker.BrokerStartup %* + +IF %ERRORLEVEL% EQU 0 ( + ECHO "Broker starts OK" +) \ No newline at end of file diff --git a/carrera-prod/n02/broker/bin/mqbroker.numanode0 b/carrera-prod/n02/broker/bin/mqbroker.numanode0 new file mode 100755 index 0000000..b7486a7 --- /dev/null +++ b/carrera-prod/n02/broker/bin/mqbroker.numanode0 @@ -0,0 +1,47 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +export RMQ_NUMA_NODE=0 + +sh ${ROCKETMQ_HOME}/bin/mqbroker $@ diff --git a/carrera-prod/n02/broker/bin/mqbroker.numanode1 b/carrera-prod/n02/broker/bin/mqbroker.numanode1 new file mode 100755 index 0000000..c301fed --- /dev/null +++ b/carrera-prod/n02/broker/bin/mqbroker.numanode1 @@ -0,0 +1,47 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +export RMQ_NUMA_NODE=1 + +sh ${ROCKETMQ_HOME}/bin/mqbroker $@ diff --git a/carrera-prod/n02/broker/bin/mqbroker.numanode2 b/carrera-prod/n02/broker/bin/mqbroker.numanode2 new file mode 100755 index 0000000..ea95304 --- /dev/null +++ b/carrera-prod/n02/broker/bin/mqbroker.numanode2 @@ -0,0 +1,47 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +export RMQ_NUMA_NODE=2 + +sh ${ROCKETMQ_HOME}/bin/mqbroker $@ diff --git a/carrera-prod/n02/broker/bin/mqbroker.numanode3 b/carrera-prod/n02/broker/bin/mqbroker.numanode3 new file mode 100755 index 0000000..25d3d1d --- /dev/null +++ b/carrera-prod/n02/broker/bin/mqbroker.numanode3 @@ -0,0 +1,47 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +export RMQ_NUMA_NODE=3 + +sh ${ROCKETMQ_HOME}/bin/mqbroker $@ diff --git a/carrera-prod/n02/broker/bin/mqbroker.xml b/carrera-prod/n02/broker/bin/mqbroker.xml new file mode 100755 index 0000000..3043cc0 --- /dev/null +++ b/carrera-prod/n02/broker/bin/mqbroker.xml @@ -0,0 +1,45 @@ + + + + false + + ${JAVA_HOME} + + server + + org.apache.rocketmq.broker.BrokerStartup + + + ${cpd}/../lib + ${cpd}/.. + + + + + + + <-Xms512m> + + <-Xmx1g> + +<-XX:NewSize>256M +<-XX:MaxNewSize>512M +<-XX:PermSize>128M +<-XX:MaxPermSize>128M + + diff --git a/carrera-prod/n02/broker/bin/mqfiltersrv b/carrera-prod/n02/broker/bin/mqfiltersrv new file mode 100755 index 0000000..2fd0cbe --- /dev/null +++ b/carrera-prod/n02/broker/bin/mqfiltersrv @@ -0,0 +1,45 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +sh ${ROCKETMQ_HOME}/bin/runserver.sh org.apache.rocketmq.filtersrv.FiltersrvStartup $@ diff --git a/carrera-prod/n02/broker/bin/mqfiltersrv.cmd b/carrera-prod/n02/broker/bin/mqfiltersrv.cmd new file mode 100755 index 0000000..0503026 --- /dev/null +++ b/carrera-prod/n02/broker/bin/mqfiltersrv.cmd @@ -0,0 +1,23 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%ROCKETMQ_HOME%\bin\runbroker.cmd" echo Please set the ROCKETMQ_HOME variable in your environment! & EXIT /B 1 + +call "%ROCKETMQ_HOME%\bin\runserver.cmd" org.apache.rocketmq.filtersrv.FiltersrvStartup %* + +IF %ERRORLEVEL% EQU 0 ( + ECHO "Filtersrv starts OK" +) \ No newline at end of file diff --git a/carrera-prod/n02/broker/bin/mqfiltersrv.xml b/carrera-prod/n02/broker/bin/mqfiltersrv.xml new file mode 100755 index 0000000..dc36a8d --- /dev/null +++ b/carrera-prod/n02/broker/bin/mqfiltersrv.xml @@ -0,0 +1,45 @@ + + + + false + + ${JAVA_HOME} + + server + + org.apache.rocketmq.filtersrv.FiltersrvStartup + + + ${cpd}/../lib + ${cpd}/.. + + + + + + + <-Xms512m> + + <-Xmx1g> + +<-XX:NewSize>256M +<-XX:MaxNewSize>512M +<-XX:PermSize>128M +<-XX:MaxPermSize>128M + + diff --git a/carrera-prod/n02/broker/bin/mqnamesrv b/carrera-prod/n02/broker/bin/mqnamesrv new file mode 100755 index 0000000..c1e70bd --- /dev/null +++ b/carrera-prod/n02/broker/bin/mqnamesrv @@ -0,0 +1,45 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +sh ${ROCKETMQ_HOME}/bin/runserver.sh org.apache.rocketmq.namesrv.NamesrvStartup $@ diff --git a/carrera-prod/n02/broker/bin/mqnamesrv.cmd b/carrera-prod/n02/broker/bin/mqnamesrv.cmd new file mode 100755 index 0000000..2828bdc --- /dev/null +++ b/carrera-prod/n02/broker/bin/mqnamesrv.cmd @@ -0,0 +1,23 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%ROCKETMQ_HOME%\bin\runserver.cmd" echo Please set the ROCKETMQ_HOME variable in your environment! & EXIT /B 1 + +call "%ROCKETMQ_HOME%\bin\runserver.cmd" org.apache.rocketmq.namesrv.NamesrvStartup %* + +IF %ERRORLEVEL% EQU 0 ( + ECHO "Namesrv starts OK" +) \ No newline at end of file diff --git a/carrera-prod/n02/broker/bin/mqnamesrv.xml b/carrera-prod/n02/broker/bin/mqnamesrv.xml new file mode 100755 index 0000000..1f050d1 --- /dev/null +++ b/carrera-prod/n02/broker/bin/mqnamesrv.xml @@ -0,0 +1,45 @@ + + + + false + + ${JAVA_HOME} + + server + + org.apache.rocketmq.namesrv.NamesrvStartup + + + ${cpd}/../lib + ${cpd}/.. + + + + + + + <-Xms512m> + + <-Xmx1g> + +<-XX:NewSize>256M +<-XX:MaxNewSize>512M +<-XX:PermSize>128M +<-XX:MaxPermSize>128M + + diff --git a/carrera-prod/n02/broker/bin/mqshutdown b/carrera-prod/n02/broker/bin/mqshutdown new file mode 100755 index 0000000..d2d51fc --- /dev/null +++ b/carrera-prod/n02/broker/bin/mqshutdown @@ -0,0 +1,49 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +case $1 in + broker) + + pid=`ps ax | grep -i 'org.apache.rocketmq.broker.BrokerStartup' |grep java | grep -v grep | awk '{print $1}'` + if [ -z "$pid" ] ; then + echo "No mqbroker running." + exit -1; + fi + + echo "The mqbroker(${pid}) is running..." + + kill ${pid} + + echo "Send shutdown request to mqbroker(${pid}) OK" + ;; + namesrv) + + pid=`ps ax | grep -i 'org.apache.rocketmq.namesrv.NamesrvStartup' |grep java | grep -v grep | awk '{print $1}'` + if [ -z "$pid" ] ; then + echo "No mqnamesrv running." + exit -1; + fi + + echo "The mqnamesrv(${pid}) is running..." + + kill ${pid} + + echo "Send shutdown request to mqnamesrv(${pid}) OK" + ;; + *) + echo "Useage: mqshutdown broker | namesrv" +esac diff --git a/carrera-prod/n02/broker/bin/mqshutdown.cmd b/carrera-prod/n02/broker/bin/mqshutdown.cmd new file mode 100755 index 0000000..50af026 --- /dev/null +++ b/carrera-prod/n02/broker/bin/mqshutdown.cmd @@ -0,0 +1,35 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%JAVA_HOME%\bin\jps.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! & EXIT /B 1 + +setlocal + +set "PATH=%JAVA_HOME%\bin;%PATH%" + +if /I "%1" == "broker" ( + echo killing broker + for /f "tokens=1" %%i in ('jps -m ^| find "BrokerStartup"') do ( taskkill /F /PID %%i ) + echo Done! +) else if /I "%1" == "namesrv" ( + echo killing name server + + for /f "tokens=1" %%i in ('jps -m ^| find "NamesrvStartup"') do ( taskkill /F /PID %%i ) + + echo Done! +) else ( + echo Unknown role to kill, please specify broker or namesrv +) \ No newline at end of file diff --git a/carrera-prod/n02/broker/bin/os.sh b/carrera-prod/n02/broker/bin/os.sh new file mode 100755 index 0000000..cb5cf05 --- /dev/null +++ b/carrera-prod/n02/broker/bin/os.sh @@ -0,0 +1,67 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=$PATH:/sbin + +HOME="/home/xiaoju" +if [ -d ${HOME}/tmpfs ] ; then + echo "tmpfs exist, do nothing." +else + ln -s /dev/shm ${HOME}/tmpfs + echo "create tmpfs ok" +fi + +# sudo sysctl -w vm.extra_free_kbytes=2000000 +# sudo sysctl -w vm.min_free_kbytes=1000000 +sudo sysctl -w vm.overcommit_memory=1 +sudo sysctl -w vm.drop_caches=1 +sudo sysctl -w vm.zone_reclaim_mode=0 +sudo sysctl -w vm.max_map_count=655360 +sudo sysctl -w vm.dirty_background_ratio=50 +sudo sysctl -w vm.dirty_ratio=50 +sudo sysctl -w vm.dirty_writeback_centisecs=360000 +sudo sysctl -w vm.page-cluster=3 +sudo sysctl -w vm.swappiness=1 + +echo 'ulimit -n 655350' >> /etc/profile +echo '* hard nofile 655350' >> /etc/security/limits.conf + +echo '* hard memlock unlimited' >> /etc/security/limits.conf +echo '* soft memlock unlimited' >> /etc/security/limits.conf + +DISK=`df -k | sort -n -r -k 2 | awk -F/ 'NR==1 {gsub(/[0-9].*/,"",$3); print $3}'` +[ "$DISK" = 'cciss' ] && DISK='cciss!c0d0' +echo 'deadline' > /sys/block/${DISK}/queue/scheduler + + +echo "---------------------------------------------------------------" +sysctl vm.extra_free_kbytes +sysctl vm.min_free_kbytes +sysctl vm.overcommit_memory +sysctl vm.drop_caches +sysctl vm.zone_reclaim_mode +sysctl vm.max_map_count +sysctl vm.dirty_background_ratio +sysctl vm.dirty_ratio +sysctl vm.dirty_writeback_centisecs +sysctl vm.page-cluster +sysctl vm.swappiness + +#su - admin -c 'ulimit -n' +ulimit -n +cat /sys/block/$DISK/queue/scheduler + diff --git a/carrera-prod/n02/broker/bin/play.cmd b/carrera-prod/n02/broker/bin/play.cmd new file mode 100755 index 0000000..f1737d5 --- /dev/null +++ b/carrera-prod/n02/broker/bin/play.cmd @@ -0,0 +1,30 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +START /B mqnamesrv > ns.log 2>&1 +IF %ERRORLEVEL% NEQ 0 ( + echo "Failed to start name server. Please check ns.log" + EXIT /B 1 +) + +START /B mqbroker -n localhost:9876 > bk.log 2>&1 + +IF %ERRORLEVEL% NEQ 0 ( + ECHO "Failed to start broker. Please check bk.log" + EXIT /B 1 +) + +echo "Start Name Server and Broker Successfully." \ No newline at end of file diff --git a/carrera-prod/n02/broker/bin/play.sh b/carrera-prod/n02/broker/bin/play.sh new file mode 100755 index 0000000..359d18d --- /dev/null +++ b/carrera-prod/n02/broker/bin/play.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Name Server +# +nohup sh mqnamesrv > ns.log 2>&1 & + +# +# Service Addr +# +ADDR=`hostname -i`:9876 + +# +# Broker +# +nohup sh mqbroker -n ${ADDR} > bk.log 2>&1 & + +echo "Start Name Server and Broker Successfully, ${ADDR}" diff --git a/carrera-prod/n02/broker/bin/runbroker b/carrera-prod/n02/broker/bin/runbroker new file mode 100755 index 0000000..538f8e1 --- /dev/null +++ b/carrera-prod/n02/broker/bin/runbroker @@ -0,0 +1,15 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. diff --git a/carrera-prod/n02/broker/bin/runbroker.cmd b/carrera-prod/n02/broker/bin/runbroker.cmd new file mode 100755 index 0000000..eab7e30 --- /dev/null +++ b/carrera-prod/n02/broker/bin/runbroker.cmd @@ -0,0 +1,42 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%JAVA_HOME%\bin\java.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! & EXIT /B 1 +set "JAVA=%JAVA_HOME%\bin\java.exe" + +setlocal + +set BASE_DIR=%~dp0 +set BASE_DIR=%BASE_DIR:~0,-1% +for %%d in (%BASE_DIR%) do set BASE_DIR=%%~dpd + +set CLASSPATH=.;%BASE_DIR%conf;%CLASSPATH% + +rem =========================================================================================== +rem JVM Configuration +rem =========================================================================================== +set "JAVA_OPT=%JAVA_OPT% -server -Xms2g -Xmx2g -Xmn1g" +set "JAVA_OPT=%JAVA_OPT% -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0 -XX:SurvivorRatio=8" +set "JAVA_OPT=%JAVA_OPT% -verbose:gc -Xloggc:%USERPROFILE%\mq_gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintAdaptiveSizePolicy" +set "JAVA_OPT=%JAVA_OPT% -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=30m" +set "JAVA_OPT=%JAVA_OPT% -XX:-OmitStackTraceInFastThrow" +set "JAVA_OPT=%JAVA_OPT% -XX:+AlwaysPreTouch" +set "JAVA_OPT=%JAVA_OPT% -XX:MaxDirectMemorySize=15g" +set "JAVA_OPT=%JAVA_OPT% -XX:-UseLargePages -XX:-UseBiasedLocking" +set "JAVA_OPT=%JAVA_OPT% -Djava.ext.dirs=%BASE_DIR%lib" +set "JAVA_OPT=%JAVA_OPT% -cp %CLASSPATH%" + +"%JAVA%" %JAVA_OPT% %* \ No newline at end of file diff --git a/carrera-prod/n02/broker/bin/runbroker.sh b/carrera-prod/n02/broker/bin/runbroker.sh new file mode 100755 index 0000000..26c6896 --- /dev/null +++ b/carrera-prod/n02/broker/bin/runbroker.sh @@ -0,0 +1,61 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#=========================================================================================== +# Java Environment Setting +#=========================================================================================== +error_exit () +{ + echo "ERROR: $1 !!" + exit 1 +} + +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java +[ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)!" + +export JAVA_HOME +export JAVA="$JAVA_HOME/bin/java" +export BASE_DIR=$(dirname $0)/.. +export CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH} + +#=========================================================================================== +# JVM Configuration +#=========================================================================================== +JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m -Xmn256m" +JAVA_OPT="${JAVA_OPT} -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0 -XX:SurvivorRatio=8" +JAVA_OPT="${JAVA_OPT} -verbose:gc -Xloggc:/dev/shm/mq_gc_%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintAdaptiveSizePolicy" +JAVA_OPT="${JAVA_OPT} -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=30m" +JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow" +JAVA_OPT="${JAVA_OPT} -XX:+AlwaysPreTouch" +JAVA_OPT="${JAVA_OPT} -XX:MaxDirectMemorySize=256m" +JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages -XX:-UseBiasedLocking" +JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${BASE_DIR}/lib" +JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}" +JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}" + +numactl --interleave=all pwd > /dev/null 2>&1 +if [ $? -eq 0 ] +then + if [ -z "$RMQ_NUMA_NODE" ] ; then + numactl --interleave=all $JAVA ${JAVA_OPT} $@ + else + numactl --cpunodebind=$RMQ_NUMA_NODE --membind=$RMQ_NUMA_NODE $JAVA ${JAVA_OPT} $@ + fi +else + $JAVA ${JAVA_OPT} $@ +fi diff --git a/carrera-prod/n02/broker/bin/runserver.cmd b/carrera-prod/n02/broker/bin/runserver.cmd new file mode 100755 index 0000000..48e32bf --- /dev/null +++ b/carrera-prod/n02/broker/bin/runserver.cmd @@ -0,0 +1,37 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + + +if not exist "%JAVA_HOME%\bin\java.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! & EXIT /B 1 +set "JAVA=%JAVA_HOME%\bin\java.exe" + +setlocal + +set BASE_DIR=%~dp0 +set BASE_DIR=%BASE_DIR:~0,-1% +for %%d in (%BASE_DIR%) do set BASE_DIR=%%~dpd + +set CLASSPATH=.;%BASE_DIR%conf;%CLASSPATH% + +set "JAVA_OPT=%JAVA_OPT% -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m" +set "JAVA_OPT=%JAVA_OPT% -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 -XX:-UseParNewGC" +set "JAVA_OPT=%JAVA_OPT% -verbose:gc -Xloggc:"%USERPROFILE%\rmq_srv_gc.log" -XX:+PrintGCDetails" +set "JAVA_OPT=%JAVA_OPT% -XX:-OmitStackTraceInFastThrow" +set "JAVA_OPT=%JAVA_OPT% -XX:-UseLargePages" +set "JAVA_OPT=%JAVA_OPT% -Djava.ext.dirs=%BASE_DIR%lib" +set "JAVA_OPT=%JAVA_OPT% -cp "%CLASSPATH%"" + +"%JAVA%" %JAVA_OPT% %* \ No newline at end of file diff --git a/carrera-prod/n02/broker/bin/runserver.sh b/carrera-prod/n02/broker/bin/runserver.sh new file mode 100755 index 0000000..297d206 --- /dev/null +++ b/carrera-prod/n02/broker/bin/runserver.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#=========================================================================================== +# Java Environment Setting +#=========================================================================================== +error_exit () +{ + echo "ERROR: $1 !!" + exit 1 +} + +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java +[ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)!" + +export JAVA_HOME +export JAVA="$JAVA_HOME/bin/java" +export BASE_DIR=$(dirname $0)/.. +export CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH} + +#=========================================================================================== +# JVM Configuration +#=========================================================================================== +JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m" +JAVA_OPT="${JAVA_OPT} -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 -XX:-UseParNewGC" +JAVA_OPT="${JAVA_OPT} -verbose:gc -Xloggc:/dev/shm/rmq_srv_gc.log -XX:+PrintGCDetails" +JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow" +JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages" +JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${BASE_DIR}/lib" +#JAVA_OPT="${JAVA_OPT} -Xdebug -Xrunjdwp:transport=dt_socket,address=9555,server=y,suspend=n" +JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}" +JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}" + +$JAVA ${JAVA_OPT} $@ diff --git a/carrera-prod/n02/broker/bin/setcache.sh b/carrera-prod/n02/broker/bin/setcache.sh new file mode 100755 index 0000000..27633f3 --- /dev/null +++ b/carrera-prod/n02/broker/bin/setcache.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=$PATH:/sbin + +# +# GB +# +function changeFreeCache() +{ + EXTRA=$1 + MIN=$2 + sysctl -w vm.extra_free_kbytes=${EXTRA}000000 + sysctl -w vm.min_free_kbytes=${MIN}000000 + sysctl -w vm.swappiness=0 +} + + +if [ $# -ne 2 ] +then + echo "Usage: $0 extra_free_kbytes(GB) min_free_kbytes(GB)" + echo "Example: $0 3 1" + exit +fi + +changeFreeCache $1 $2 diff --git a/carrera-prod/n02/broker/bin/startfsrv.sh b/carrera-prod/n02/broker/bin/startfsrv.sh new file mode 100755 index 0000000..f7ba188 --- /dev/null +++ b/carrera-prod/n02/broker/bin/startfsrv.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +nohup sh ${ROCKETMQ_HOME}/bin/runserver.sh org.apache.rocketmq.filtersrv.FiltersrvStartup $@ & diff --git a/carrera-prod/n02/broker/bin/tools.cmd b/carrera-prod/n02/broker/bin/tools.cmd new file mode 100755 index 0000000..28ce765 --- /dev/null +++ b/carrera-prod/n02/broker/bin/tools.cmd @@ -0,0 +1,35 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%JAVA_HOME%\bin\java.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! & EXIT /B 1 + +set "JAVA=%JAVA_HOME%\bin\java.exe" + +setlocal +set BASE_DIR=%~dp0 +set BASE_DIR=%BASE_DIR:~0,-1% +for %%d in (%BASE_DIR%) do set BASE_DIR=%%~dpd + +set CLASSPATH=.;%BASE_DIR%conf;%CLASSPATH% + +rem =========================================================================================== +rem JVM Configuration +rem =========================================================================================== +set "JAVA_OPT=%JAVA_OPT% -server -Xms1g -Xmx1g -Xmn256m -XX:PermSize=128m -XX:MaxPermSize=128m" +set "JAVA_OPT=%JAVA_OPT% -Djava.ext.dirs="%BASE_DIR%\lib";"%JAVA_HOME%\jre\lib\ext"" +set "JAVA_OPT=%JAVA_OPT% -cp "%CLASSPATH%"" + +"%JAVA%" %JAVA_OPT% %* \ No newline at end of file diff --git a/carrera-prod/n02/broker/bin/tools.sh b/carrera-prod/n02/broker/bin/tools.sh new file mode 100755 index 0000000..e0c840c --- /dev/null +++ b/carrera-prod/n02/broker/bin/tools.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#=========================================================================================== +# Java Environment Setting +#=========================================================================================== +error_exit () +{ + echo "ERROR: $1 !!" + exit 1 +} + +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java +[ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)!" + +export JAVA_HOME +export JAVA="$JAVA_HOME/bin/java" +export BASE_DIR=$(dirname $0)/.. +export CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH} + +#=========================================================================================== +# JVM Configuration +#=========================================================================================== +JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn256m" +JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${BASE_DIR}/lib:${JAVA_HOME}/jre/lib/ext" +JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}" + +$JAVA ${JAVA_OPT} $@ diff --git a/carrera-prod/n02/broker/conf/2m-2s-async/broker-a-s.properties b/carrera-prod/n02/broker/conf/2m-2s-async/broker-a-s.properties new file mode 100644 index 0000000..b5e8039 --- /dev/null +++ b/carrera-prod/n02/broker/conf/2m-2s-async/broker-a-s.properties @@ -0,0 +1,87 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +brokerClusterName=DefaultCluster +brokerName=broker-a +brokerId=1 +brokerRole=SLAVE +flushDiskType=ASYNC_FLUSH +# +# broker 对外服务的监听端口 +# +listenPort=10921 +# +# nameserver 地址,分号分割 +# +namesrvAddr=172.18.0.3:9876;172.18.0.4:9876 +# +# brokerIP1 +# +brokerIP1=172.18.0.4 +# +# 在发送消息时,自动创建服务器不存在的topic,默认创建的队列数 +# +defaultTopicQueueNums=4 +# +# 是否允许 Broker 自动创建Topic,建议线下开启,线上关闭 +# +autoCreateTopicEnable=false +# +# 是否允许 Broker 自动创建订阅组,建议线下开启,线上关闭 +# +autoCreateSubscriptionGroup=true +# +# store存储位置 +# +storePathRootDir=/root/rocketmq/broker-a-s/store +storePathCommitLog=/root/rocketmq/broker-a-s/store/commitlog +# +# 消费队列存储路径存储路径 +# +storePathConsumerQueue=/root/rocketmq/broker-a-s/store/consumequeue +# +# 消息索引存储路径 +# +storePathIndex=/root/rocketmq/broker-a-s/store/index +# +# checkpoint 文件存储路径 +# +storeCheckpoint=/root/rocketmq/broker-a-s/store/checkpoint +# +# abort 文件存储路径 +# +abortFile=/root/rocketmq/broker-a-s/store/abort +# +# 删除文件时间点,默认凌晨 4点 +# +deleteWhen=04 +# +# 文件保留时间,默认 48 小时 +# +fileReservedTime=120 +# +# commitLog每个文件的大小默认1G +# +mapedFileSizeCommitLog=1073741824 +# +# ConsumeQueue每个文件默认存30W条,根据业务情况调整 +# +mapedFileSizeConsumeQueue=300000 +# +#destroyMapedFileIntervalForcibly=120000 +#redeleteHangedFileInterval=120000 +# +# 检测物理文件磁盘空间 +# +#diskMaxUsedSpaceRatio=88 diff --git a/carrera-prod/n02/broker/conf/2m-2s-async/broker-b.properties b/carrera-prod/n02/broker/conf/2m-2s-async/broker-b.properties new file mode 100644 index 0000000..78dcaed --- /dev/null +++ b/carrera-prod/n02/broker/conf/2m-2s-async/broker-b.properties @@ -0,0 +1,87 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +brokerClusterName=DefaultCluster +brokerName=broker-b +brokerId=0 +brokerRole=ASYNC_MASTER +flushDiskType=ASYNC_FLUSH +# +# Broker 对外服务的监听端口 +# +listenPort=10911 +# +# nameserver 地址,分号分割 +# +namesrvAddr=172.18.0.3:9876;172.18.0.4:9876;172.18.0.5:9876 +# +# brokerIP1 +# +brokerIP1=172.18.0.4 +# +# 在发送消息时,自动创建服务器不存在的topic,默认创建的队列数 +# +defaultTopicQueueNums=4 +# +# 是否允许 Broker 自动创建Topic,建议线下开启,线上关闭 +# +autoCreateTopicEnable=false +# +# 是否允许 Broker 自动创建订阅组,建议线下开启,线上关闭 +# +autoCreateSubscriptionGroup=true +# +# store存储位置 +# +storePathRootDir=/root/rocketmq/broker-b/store +storePathCommitLog=/root/rocketmq/broker-b/store/commitlog +# +# 消费队列存储路径存储路径 +# +storePathConsumerQueue=/root/rocketmq/broker-b/store/consumequeue +# +# 消息索引存储路径 +# +storePathIndex=/root/rocketmq/broker-b/store/index +# +# checkpoint 文件存储路径 +# +storeCheckpoint=/root/rocketmq/broker-b/store/checkpoint +# +# abort 文件存储路径 +# +abortFile=/root/rocketmq/broker-b/store/abort +# +# 删除文件时间点,默认凌晨 4点 +# +deleteWhen=04 +# +# 文件保留时间,默认 48 小时 +# +fileReservedTime=120 +# +# commitLog每个文件的大小默认1G +# +mapedFileSizeCommitLog=1073741824 +# +# ConsumeQueue每个文件默认存30W条,根据业务情况调整 +# +mapedFileSizeConsumeQueue=300000 +# +#destroyMapedFileIntervalForcibly=120000 +#redeleteHangedFileInterval=120000 +# +# 检测物理文件磁盘空间 +# +#diskMaxUsedSpaceRatio=88 \ No newline at end of file diff --git a/carrera-prod/n02/broker/conf/logback_broker.xml b/carrera-prod/n02/broker/conf/logback_broker.xml new file mode 100644 index 0000000..d15c205 --- /dev/null +++ b/carrera-prod/n02/broker/conf/logback_broker.xml @@ -0,0 +1,337 @@ + + + + + + ${user.home}/logs/rocketmqlogs/broker_default.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/broker_default.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + ${user.home}/logs/rocketmqlogs/broker.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/broker.%i.log.gz + 1 + 20 + + + 128MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/protection.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/protection.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/watermark.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/watermark.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/store.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/store.%i.log.gz + 1 + 10 + + + 128MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/remoting.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/remoting.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/storeerror.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/storeerror.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + + ${user.home}/logs/rocketmqlogs/transaction.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/transaction.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/lock.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/lock.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/filter.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/filter.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/stats.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/stats.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p - %m%n + UTF-8 + + + + + ${user.home}/logs/rocketmqlogs/commercial.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/commercial.%i.log.gz + 1 + 10 + + + 500MB + + + + + true + + %d{yyy-MM-dd HH\:mm\:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n02/broker/conf/logback_filtersrv.xml b/carrera-prod/n02/broker/conf/logback_filtersrv.xml new file mode 100644 index 0000000..71b9a93 --- /dev/null +++ b/carrera-prod/n02/broker/conf/logback_filtersrv.xml @@ -0,0 +1,87 @@ + + + + + + ${user.home}/logs/rocketmqlogs/filtersrv_default.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/filtersrv_default.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + ${user.home}/logs/rocketmqlogs/filtersrv.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/filtersrv.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + 0 + + + + true + + %d{yyy-MM-dd HH\:mm\:ss,SSS} %p %t - %m%n + UTF-8 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n02/broker/conf/logback_namesrv.xml b/carrera-prod/n02/broker/conf/logback_namesrv.xml new file mode 100644 index 0000000..c68c8b6 --- /dev/null +++ b/carrera-prod/n02/broker/conf/logback_namesrv.xml @@ -0,0 +1,89 @@ + + + + + + ${user.home}/logs/rocketmqlogs/namesrv_default.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/namesrv_default.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + ${user.home}/logs/rocketmqlogs/namesrv.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/namesrv.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + 0 + + + + true + + %d{yyy-MM-dd HH\:mm\:ss,SSS} %p %t - %m%n + UTF-8 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n02/broker/conf/logback_tools.xml b/carrera-prod/n02/broker/conf/logback_tools.xml new file mode 100644 index 0000000..28283ad --- /dev/null +++ b/carrera-prod/n02/broker/conf/logback_tools.xml @@ -0,0 +1,93 @@ + + + + + + ${user.home}/logs/rocketmqlogs/tools_default.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/tools_default.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + ${user.home}/logs/rocketmqlogs/tools.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/tools.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + + true + + %d{yyy-MM-dd HH\:mm\:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n02/broker/control.sh b/carrera-prod/n02/broker/control.sh new file mode 100755 index 0000000..8e1c925 --- /dev/null +++ b/carrera-prod/n02/broker/control.sh @@ -0,0 +1,100 @@ +#!/bin/bash +MAIN_CLASS=rocketmq.broker.BrokerStartup +LOG_HOME="${HOME}"/logs/rocketmqlogs + +mkdir -p ${LOG_HOME} +mkdir -p "${HOME}"/rocketmq/broker-b/store +mkdir -p "${HOME}"/rocketmq/broker-a-s/store + +function get_pid() { + PID=$(ps ax | grep -i ${MAIN_CLASS} |grep java | grep -v grep | awk '{print $1}') +} + +function start() { + get_pid + if [ ! -z "$PID" ] ; then + echo "Shutdown old process($MAIN_CLASS) first, pid=${PID}" + exit 1 + fi + + echo "back up logs" + if [ -d ${LOG_HOME} ]; then + cd ${LOG_HOME} + for f in $(ls ${LOG_HOME}) + do + if [ -d $f ]; then + continue; + fi + if [ -f otherdays/$f ]; then + mv otherdays/$f otherdays/$f.old + fi + mv $f otherdays/ + done + fi + + + cd ${workspace} + nohup sh bin/mqbroker -c ${workspace}/conf/2m-2s-async/broker-b.properties -n"172.18.0.3:9876;172.18.0.4:9876" >> ${LOG_HOME}/broker-b.log 2>&1 & + echo "running: nohup sh bin/mqbroker -c ${workspace}/conf/2m-2s-async/broker-b.properties -n'172.18.0.3:9876;172.18.0.4:9876' >> ${LOG_HOME}/broker-b.log 2>&1 &" + + nohup sh bin/mqbroker -c ${workspace}/conf/2m-2s-async/broker-a-s.properties -n"172.18.0.3:9876;172.18.0.4:9876" >> ${LOG_HOME}/broker-a-s.log 2>&1 & + echo "running: nohup sh bin/mqbroker -c ${workspace}/conf/2m-2s-async/broker-a-s.properties -n'172.18.0.3:9876;172.18.0.4:9876' >> ${LOG_HOME}/broker-a-s.log 2>&1 &" + + get_pid + t=0 + while [[ -z ${PID} && "$t" -lt 10 ]]; do + echo "time=$t,starting process($MAIN_CLASS)" + get_pid + t=$(($t+1)) + sleep 0.5 + done + + if [ -z ${PID} ]; then + echo "start process($MAIN_CLASS) failed!!!" + exit 1 + else + echo "start process($MAIN_CLASS) success, pid=${PID}" + fi +} + +function stop() { + get_pid + if [ -z "$PID" ] ; then + echo "no process running..." + else + echo "killing process($MAIN_CLASS), pid=${PID}" + kill ${PID} + fi + + t=0 + while [[ ! -z ${PID} && "$t" -lt 60 ]]; do + echo "time=$t,killing process($MAIN_CLASS), pid=${PID}" + get_pid + t=$(($t+1)) + sleep 1 + done + + if [ ! -z ${PID} ]; then + echo "killing process($MAIN_CLASS), pid=${PID}" + exit 1 + fi +} + +workspace=$(cd $(dirname $0) && pwd -P) +cd ${workspace} + +case "$1" in + "start") + start + ;; + "stop") + stop + ;; + "reload") + stop + start + ;; + *) + echo "supporting cmd: start/stop/reload" + ;; +esac diff --git a/carrera-prod/n02/chronos/conf/chronos.yaml b/carrera-prod/n02/chronos/conf/chronos.yaml new file mode 100644 index 0000000..89b441c --- /dev/null +++ b/carrera-prod/n02/chronos/conf/chronos.yaml @@ -0,0 +1,118 @@ +#cluster, for master election purpose +clusterName : test +#group in cluster, for master election purpose +groupName : group_0 +pullOn : true +pushOn : true +deleteOn : true +standAlone : false +fakeSend : false + +dbConfig: + dbPath : "/root/chronos-storage/rocksdb" + seekTimestampPath : "/root/chronos-storage/seektimestamp" + + # path Where to keep the backup files. Has to be different than dbname + dbPathBackup : "/root/chronos-storage/rocksdb_backup" + dbPathRestore : "/root/chronos-storage/rocksdb_restore" + + # https://github.com/facebook/rocksdb/wiki/RocksDB-Tuning-Guide#compaction-stats + # Parallelism options + # In LSM architecture, there are two background processes: flush and compaction. + # Both can execute concurrently via threads to take advantage of storage technology + # concurrency. Flush threads are in the HIGH priority pool, while compaction threads + # are in the LOW priority pool. To benefit from more threads you might need to set + # these options to change the max number of concurrent compactions and flushes: + # max_background_flushes is the maximum number of concurrent flush operations. + # It is usually good enough to set this to 1. + maxBackgroundFlushes : 10 + + # max_background_compactions is the maximum number of concurrent background compactions. + # The default is 1, but to fully utilize your CPU and storage you might want to + # increase this to approximately number of cores in the system. + maxBackgroundCompactions : 35 + baseBackgroundCompactions : 5 + + # RocksDB memtable 的大小, 单位 MB + writeBufferSize : 128 + + # 最多允许几个 memtable 存在。写入到 RocksDB 的数据首先会记录到 WAL 日志里面,然后会插入到 + # memtable 里面,当 memtable 的大小到达了 write-buffer-size 限定的大小的时候,当前的 + # memtable 会变成只读的,然后生成一个新的 memtable 接收新的写入。只读的 memtable 会被 + # RocksDB 的 flush 线程(max-background-flushes 参数能够控制 flush 线程的最大个数) + # flush 到磁盘,成为 level0 的一个 sst 文件。当 flush 线程忙不过来,导致等待 flush 到磁盘的 + # memtable 的数量到达 max-write-buffer-number 限定的个数的时候,RocksDB 会将新的写入 + # stall 住,stall 是 RocksDB 的一种流控机制。在导数据的时候可以将 max-write-buffer-number + # 的值设置的更大一点,例如 10。 + maxWriteBufferNumber : 10 + + maxSubcompactions : 10 + + # 当 level0 的 sst 文件个数到达 level0-slowdown-writes-trigger 指定的限度的时候, + # RocksDB 会尝试减慢写入的速度。因为 level0 的 sst 太多会导致 RocksDB 的读放大上升。 + # level0-slowdown-writes-trigger 和 level0-stop-writes-trigger 是 RocksDB 进行流控的 + # 另一个表现。当 level0 的 sst 的文件个数到达 4(默认值),level0 的 sst 文件会和 level1 中 + # 有 overlap 的 sst 文件进行 compaction,缓解读放大的问题。 + level0SlowdownWritesTrigger : 30 + + # 当 level0 的 sst 文件个数到达 level0-stop-writes-trigger 指定的限度的时候,RocksDB 会 + # stall 住新的写入。 + level0StopWritesTrigger : 50 + + # 当 level1 的数据量大小达到 max-bytes-for-level-base 限定的值的时候,会触发 level1 的 + # sst 和 level2 种有 overlap 的 sst 进行 compaction。 + # 黄金定律:max-bytes-for-level-base 的设置的第一参考原则就是保证和 level0 的数据量大致相 + # 等,这样能够减少不必要的 compaction。例如压缩方式为"no:no:lz4:lz4:lz4:lz4:lz4",那么 + # max-bytes-for-level-base 的值应该是 write-buffer-size 的大小乘以 4,因为 level0 和 + # level1 都没有压缩,而且 level0 触发 compaction 的条件是 sst 的个数到达 4(默认值)。在 + # level0 和 level1 都采取了压缩的情况下,就需要分析下 RocksDB 的日志,看一个 memtable 的压 + # 缩成一个 sst 文件的大小大概是多少,例如 32MB,那么 max-bytes-for-level-base 的建议值就应 + # 该是 32MB * 4 = 128MB。 + maxBytesForLevelBase : 512 + + + # sst 文件的大小。level0 的 sst 文件的大小受 write-buffer-size 和 level0 采用的压缩算法的 + # 影响,target-file-size-base 参数用于控制 level1-level6 单个 sst 文件的大小。 + targetFileSizeBase : 128 + + delayedWriteRate : 64 + +pullConfig: + innerGroup : cg_R_test_chronos_inner_0_1 + innerTopic : R_test_chronos_inner_0 + cproxyAddrs : 127.0.0.1:9713 #分号分割 + retryIntervalMs : 500 + maxBatchSize : 200 + timeoutMs : 3000 + pullBatchItemNum : 10000 + threadNum : 10 + msgByteBaseLen : 1000 + +pushConfig: + pproxyAddrs : + - 127.0.0.1:9613 + proxyTimeoutMs : 200 + clientRetry : 2 + clientTimeoutMs : 300 + poolSize : 100 + pushIntervalMs : 300 + batchSendThreadNum : 50 + +deleteConfig: + deleteWhen : 04 + saveHours : 6 + +zkConfig: + zkAddrs : "127.0.0.1:2181" + zkSessionTimeoutMs : 30000 + masterPathPrefix : "/chronos/master" + metaPathPrefix : "/chronos/meta" + offsetsProp : "offsets" + seekTimestampProp : "seektimestamp" + baseSleepTimeMs : 10 #baseSleepTimeMs initial amount of time to wait between retries + maxSleepMs : 1000 #maxSleepMs max time in ms to sleep on each retry + maxRetries : 5 #maxRetries max number of times to retry + + + + diff --git a/carrera-prod/n02/chronos/conf/log4j2.xml b/carrera-prod/n02/chronos/conf/log4j2.xml new file mode 100644 index 0000000..37fb73b --- /dev/null +++ b/carrera-prod/n02/chronos/conf/log4j2.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n02/chronos/conf/test-chronos00.yaml b/carrera-prod/n02/chronos/conf/test-chronos00.yaml new file mode 100644 index 0000000..9156519 --- /dev/null +++ b/carrera-prod/n02/chronos/conf/test-chronos00.yaml @@ -0,0 +1,118 @@ +#所属集群, 用于选举master +clusterName : test +#所属集群中的组, 用于选举master +groupName : group_0 +pullOn : true +pushOn : true +deleteOn : true +standAlone : false +fakeSend : false + +dbConfig: + dbPath : "/home/xiaoju/chronos-storage/rocksdb" + seekTimestampPath : "/home/xiaoju/chronos-storage/seektimestamp" + + # path Where to keep the backup files. Has to be different than dbname + dbPathBackup : "/home/xiaoju/chronos-storage/rocksdb_backup" + dbPathRestore : "/home/xiaoju/chronos-storage/rocksdb_restore" + + # https://github.com/facebook/rocksdb/wiki/RocksDB-Tuning-Guide#compaction-stats + # Parallelism options + # In LSM architecture, there are two background processes: flush and compaction. + # Both can execute concurrently via threads to take advantage of storage technology + # concurrency. Flush threads are in the HIGH priority pool, while compaction threads + # are in the LOW priority pool. To benefit from more threads you might need to set + # these options to change the max number of concurrent compactions and flushes: + # max_background_flushes is the maximum number of concurrent flush operations. + # It is usually good enough to set this to 1. + maxBackgroundFlushes : 10 + + # max_background_compactions is the maximum number of concurrent background compactions. + # The default is 1, but to fully utilize your CPU and storage you might want to + # increase this to approximately number of cores in the system. + maxBackgroundCompactions : 35 + baseBackgroundCompactions : 5 + + # RocksDB memtable 的大小, 单位 MB + writeBufferSize : 128 + + # 最多允许几个 memtable 存在。写入到 RocksDB 的数据首先会记录到 WAL 日志里面,然后会插入到 + # memtable 里面,当 memtable 的大小到达了 write-buffer-size 限定的大小的时候,当前的 + # memtable 会变成只读的,然后生成一个新的 memtable 接收新的写入。只读的 memtable 会被 + # RocksDB 的 flush 线程(max-background-flushes 参数能够控制 flush 线程的最大个数) + # flush 到磁盘,成为 level0 的一个 sst 文件。当 flush 线程忙不过来,导致等待 flush 到磁盘的 + # memtable 的数量到达 max-write-buffer-number 限定的个数的时候,RocksDB 会将新的写入 + # stall 住,stall 是 RocksDB 的一种流控机制。在导数据的时候可以将 max-write-buffer-number + # 的值设置的更大一点,例如 10。 + maxWriteBufferNumber : 10 + + maxSubcompactions : 10 + + # 当 level0 的 sst 文件个数到达 level0-slowdown-writes-trigger 指定的限度的时候, + # RocksDB 会尝试减慢写入的速度。因为 level0 的 sst 太多会导致 RocksDB 的读放大上升。 + # level0-slowdown-writes-trigger 和 level0-stop-writes-trigger 是 RocksDB 进行流控的 + # 另一个表现。当 level0 的 sst 的文件个数到达 4(默认值),level0 的 sst 文件会和 level1 中 + # 有 overlap 的 sst 文件进行 compaction,缓解读放大的问题。 + level0SlowdownWritesTrigger : 30 + + # 当 level0 的 sst 文件个数到达 level0-stop-writes-trigger 指定的限度的时候,RocksDB 会 + # stall 住新的写入。 + level0StopWritesTrigger : 50 + + # 当 level1 的数据量大小达到 max-bytes-for-level-base 限定的值的时候,会触发 level1 的 + # sst 和 level2 种有 overlap 的 sst 进行 compaction。 + # 黄金定律:max-bytes-for-level-base 的设置的第一参考原则就是保证和 level0 的数据量大致相 + # 等,这样能够减少不必要的 compaction。例如压缩方式为"no:no:lz4:lz4:lz4:lz4:lz4",那么 + # max-bytes-for-level-base 的值应该是 write-buffer-size 的大小乘以 4,因为 level0 和 + # level1 都没有压缩,而且 level0 触发 compaction 的条件是 sst 的个数到达 4(默认值)。在 + # level0 和 level1 都采取了压缩的情况下,就需要分析下 RocksDB 的日志,看一个 memtable 的压 + # 缩成一个 sst 文件的大小大概是多少,例如 32MB,那么 max-bytes-for-level-base 的建议值就应 + # 该是 32MB * 4 = 128MB。 + maxBytesForLevelBase : 512 + + + # sst 文件的大小。level0 的 sst 文件的大小受 write-buffer-size 和 level0 采用的压缩算法的 + # 影响,target-file-size-base 参数用于控制 level1-level6 单个 sst 文件的大小。 + targetFileSizeBase : 128 + + delayedWriteRate : 64 + +pullConfig: + innerGroup : cg_R_test_chronos_inner_0_0 + innerTopic : R_test_chronos_inner_0 + cproxyAddrs : 127.0.0.1:9713 #分号分割 + retryIntervalMs : 500 + maxBatchSize : 200 + timeoutMs : 3000 + pullBatchItemNum : 10000 + threadNum : 10 + msgByteBaseLen : 1000 + +pushConfig: + pproxyAddrs : + - 127.0.0.1:9613 + proxyTimeoutMs : 200 + clientRetry : 2 + clientTimeoutMs : 300 + poolSize : 100 + pushIntervalMs : 300 + batchSendThreadNum : 50 + +deleteConfig: + deleteWhen : 04 + saveHours : 6 + +zkConfig: + zkAddrs : "127.0.0.1:2181" + zkSessionTimeoutMs : 30000 + masterPathPrefix : "/chronos/master" + metaPathPrefix : "/chronos/meta" + offsetsProp : "offsets" + seekTimestampProp : "seektimestamp" + baseSleepTimeMs : 10 #baseSleepTimeMs initial amount of time to wait between retries + maxSleepMs : 1000 #maxSleepMs max time in ms to sleep on each retry + maxRetries : 5 #maxRetries max number of times to retry + + + + diff --git a/carrera-prod/n02/chronos/conf/test-chronos01.yaml b/carrera-prod/n02/chronos/conf/test-chronos01.yaml new file mode 100644 index 0000000..5831ffd --- /dev/null +++ b/carrera-prod/n02/chronos/conf/test-chronos01.yaml @@ -0,0 +1,118 @@ +#所属集群, 用于选举master +clusterName : test +#所属集群中的组, 用于选举master +groupName : group_0 +pullOn : true +pushOn : true +deleteOn : true +standAlone : false +fakeSend : false + +dbConfig: + dbPath : "/home/xiaoju/chronos-storage/rocksdb" + seekTimestampPath : "/home/xiaoju/chronos-storage/seektimestamp" + + # path Where to keep the backup files. Has to be different than dbname + dbPathBackup : "/home/xiaoju/chronos-storage/rocksdb_backup" + dbPathRestore : "/home/xiaoju/chronos-storage/rocksdb_restore" + + # https://github.com/facebook/rocksdb/wiki/RocksDB-Tuning-Guide#compaction-stats + # Parallelism options + # In LSM architecture, there are two background processes: flush and compaction. + # Both can execute concurrently via threads to take advantage of storage technology + # concurrency. Flush threads are in the HIGH priority pool, while compaction threads + # are in the LOW priority pool. To benefit from more threads you might need to set + # these options to change the max number of concurrent compactions and flushes: + # max_background_flushes is the maximum number of concurrent flush operations. + # It is usually good enough to set this to 1. + maxBackgroundFlushes : 10 + + # max_background_compactions is the maximum number of concurrent background compactions. + # The default is 1, but to fully utilize your CPU and storage you might want to + # increase this to approximately number of cores in the system. + maxBackgroundCompactions : 35 + baseBackgroundCompactions : 5 + + # RocksDB memtable 的大小, 单位 MB + writeBufferSize : 128 + + # 最多允许几个 memtable 存在。写入到 RocksDB 的数据首先会记录到 WAL 日志里面,然后会插入到 + # memtable 里面,当 memtable 的大小到达了 write-buffer-size 限定的大小的时候,当前的 + # memtable 会变成只读的,然后生成一个新的 memtable 接收新的写入。只读的 memtable 会被 + # RocksDB 的 flush 线程(max-background-flushes 参数能够控制 flush 线程的最大个数) + # flush 到磁盘,成为 level0 的一个 sst 文件。当 flush 线程忙不过来,导致等待 flush 到磁盘的 + # memtable 的数量到达 max-write-buffer-number 限定的个数的时候,RocksDB 会将新的写入 + # stall 住,stall 是 RocksDB 的一种流控机制。在导数据的时候可以将 max-write-buffer-number + # 的值设置的更大一点,例如 10。 + maxWriteBufferNumber : 10 + + maxSubcompactions : 10 + + # 当 level0 的 sst 文件个数到达 level0-slowdown-writes-trigger 指定的限度的时候, + # RocksDB 会尝试减慢写入的速度。因为 level0 的 sst 太多会导致 RocksDB 的读放大上升。 + # level0-slowdown-writes-trigger 和 level0-stop-writes-trigger 是 RocksDB 进行流控的 + # 另一个表现。当 level0 的 sst 的文件个数到达 4(默认值),level0 的 sst 文件会和 level1 中 + # 有 overlap 的 sst 文件进行 compaction,缓解读放大的问题。 + level0SlowdownWritesTrigger : 30 + + # 当 level0 的 sst 文件个数到达 level0-stop-writes-trigger 指定的限度的时候,RocksDB 会 + # stall 住新的写入。 + level0StopWritesTrigger : 50 + + # 当 level1 的数据量大小达到 max-bytes-for-level-base 限定的值的时候,会触发 level1 的 + # sst 和 level2 种有 overlap 的 sst 进行 compaction。 + # 黄金定律:max-bytes-for-level-base 的设置的第一参考原则就是保证和 level0 的数据量大致相 + # 等,这样能够减少不必要的 compaction。例如压缩方式为"no:no:lz4:lz4:lz4:lz4:lz4",那么 + # max-bytes-for-level-base 的值应该是 write-buffer-size 的大小乘以 4,因为 level0 和 + # level1 都没有压缩,而且 level0 触发 compaction 的条件是 sst 的个数到达 4(默认值)。在 + # level0 和 level1 都采取了压缩的情况下,就需要分析下 RocksDB 的日志,看一个 memtable 的压 + # 缩成一个 sst 文件的大小大概是多少,例如 32MB,那么 max-bytes-for-level-base 的建议值就应 + # 该是 32MB * 4 = 128MB。 + maxBytesForLevelBase : 512 + + + # sst 文件的大小。level0 的 sst 文件的大小受 write-buffer-size 和 level0 采用的压缩算法的 + # 影响,target-file-size-base 参数用于控制 level1-level6 单个 sst 文件的大小。 + targetFileSizeBase : 128 + + delayedWriteRate : 64 + +pullConfig: + innerGroup : cg_R_test_chronos_inner_0_1 + innerTopic : R_test_chronos_inner_0 + cproxyAddrs : 127.0.0.1:9713 #分号分割 + retryIntervalMs : 500 + maxBatchSize : 200 + timeoutMs : 3000 + pullBatchItemNum : 10000 + threadNum : 10 + msgByteBaseLen : 1000 + +pushConfig: + pproxyAddrs : + - 127.0.0.1:9613 + proxyTimeoutMs : 200 + clientRetry : 2 + clientTimeoutMs : 300 + poolSize : 100 + pushIntervalMs : 300 + batchSendThreadNum : 50 + +deleteConfig: + deleteWhen : 04 + saveHours : 6 + +zkConfig: + zkAddrs : "127.0.0.1:2181" + zkSessionTimeoutMs : 30000 + masterPathPrefix : "/chronos/master" + metaPathPrefix : "/chronos/meta" + offsetsProp : "offsets" + seekTimestampProp : "seektimestamp" + baseSleepTimeMs : 10 #baseSleepTimeMs initial amount of time to wait between retries + maxSleepMs : 1000 #maxSleepMs max time in ms to sleep on each retry + maxRetries : 5 #maxRetries max number of times to retry + + + + diff --git a/carrera-prod/n02/chronos/control.sh b/carrera-prod/n02/chronos/control.sh new file mode 100755 index 0000000..15d6ffd --- /dev/null +++ b/carrera-prod/n02/chronos/control.sh @@ -0,0 +1,116 @@ +#!/bin/bash + +MAIN_CLASS=com.xiaojukeji.chronos.ChronosMain +CHRONOS_VERSION="1.0.0-SNAPSHOT" + +function start() { + OLD_PID="`pgrep -f ${MAIN_CLASS}`" + if [ "$OLD_PID" ]; then + echo "Chronos is already running, pid=$OLD_PID. Stop it first!" + exit 1 + fi + + BASEDIR=$(dirname "$0") + cd "${BASEDIR}" + CHRONOS_HOME=`pwd` + CHRONOS_LOG=${CHRONOS_HOME}/logs + mkdir -p ${CHRONOS_LOG}/old + + # set config + LOG_CARRERA_LEVEL="INFO" + CHRONOS_CONFIG="${CHRONOS_HOME}/conf/chronos.yaml" + LOG_SAVE_SIZE="1G" + LOG_SAVE_TIME="7d" + MEM_OPTS="-Xms256m -Xmx256m -Xmn256m" + + export LOG_SAVE_SIZE + export LOG_SAVE_TIME + export LOG_CARRERA_LEVEL + echo "MEM_OPTS:"${MEM_OPTS} + echo "JAVA_OPTS:"${JAVA_OPTS} + echo "LOG_SAVE_SIZE:"${LOG_SAVE_SIZE}", LOG_SAVE_TIME:"${LOG_SAVE_TIME}", LOG_CARRERA_LEVEL:"${LOG_CARRERA_LEVEL} + + if [ ! -f ${CHRONOS_CONFIG} ]; then + date >> ${CHRONOS_LOG}/control.log + echo "configure is not existed!" >> ${CHRONOS_LOG}/control.log + exit 1 + fi + echo "Use ${CHRONOS_CONFIG} configure" + + # backup log + LOG_NAMES=(carrera.log error.log metric.log gc.log jstat.log) + LOG_SUFFIX=$(date +%Y%m%d-%H%M%S) + for var in ${LOG_NAMES[@]}; + do + if [ -f "${CHRONOS_LOG}/${var}" ]; then + mv "${CHRONOS_LOG}/${var}" "${CHRONOS_LOG}/old/${var}.${LOG_SUFFIX}" + fi + done + + JVM_OPTS="${MEM_OPTS} ${JVM_OPTS} " + JVM_OPTS="${JVM_OPTS} -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=50 -XX:+UseCMSInitiatingOccupancyOnly" + JVM_OPTS="${JVM_OPTS} -XX:+PreserveFramePointer -XX:-UseBiasedLocking -XX:-OmitStackTraceInFastThrow" + JVM_OPTS="${JVM_OPTS} -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:${CHRONOS_LOG}/gc.log" + JVM_OPTS="${JVM_OPTS} -XX:+PrintSafepointStatistics" + CLASSPATH="${CHRONOS_HOME}/chronos-${CHRONOS_VERSION}-jar-with-dependencies.jar":${CLASSPATH} + + JAVA_OPTS="${JAVA_OPTS} -Dlog4j.configurationFile=file://${CHRONOS_HOME}/conf/log4j2.xml" + JAVA_OPTS="${JAVA_OPTS} -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector" + + CONSOLE_LOG=${CHRONOS_LOG}/console.`date +%Y-%m-%d`.log + date >> ${CONSOLE_LOG} + + java ${JVM_OPTS} ${JAVA_OPTS} -cp ${CLASSPATH} ${MAIN_CLASS} ${CHRONOS_CONFIG} >> ${CONSOLE_LOG} 2>&1 & + sleep 2 + date >> ${CHRONOS_LOG}/control.log + PID="`pgrep -f ${MAIN_CLASS}`" + if [ "$PID" ]; then + echo "NEW Chronos is running, pid=$PID" + echo "New Chronos is running, pid=$PID" >> ${CHRONOS_LOG}/control.log + jstat -gcutil -t $PID 30s >> ${CHRONOS_LOG}/gstat.log & + else + echo "Start Chronos Failed" + echo "Start Chronos Failed" >> ${CHRONOS_LOG}/control.log + exit 1 + fi +} + +function stop() { + BASEDIR=$(dirname "$0") + cd "${BASEDIR}" + CHRONOS_HOME=`pwd` + CHRONOS_LOG=${CHRONOS_HOME}/logs + mkdir -p ${CHRONOS_LOG} + + date >> ${CHRONOS_LOG}/control.log + echo "Killing Chronos =`pgrep -f ${MAIN_CLASS}`" >> ${CHRONOS_LOG}/control.log + kill -15 `pgrep -f ${MAIN_CLASS}` + t=0 + while [[ `pgrep -f ${MAIN_CLASS}` && "$t" -lt 60 ]]; do + echo "time=$t,killing `pgrep -f ${MAIN_CLASS}`" + t=$(($t+1)) + sleep 1 + done + if [ `pgrep -f ${MAIN_CLASS}` ]; then + echo "stop timeout" + echo "Stop Chronos Failed" >> ${CHRONOS_LOG}/control.log + exit 1 + fi + echo "KILLED" >> ${CHRONOS_LOG}/control.log +} + +case "$1" in + "start") + start + ;; + "stop") + stop + ;; + "reload") + stop + start + ;; + *) + echo "supporting cmd: start/stop/reload" + ;; +esac \ No newline at end of file diff --git a/carrera-prod/n02/console/carrera.war b/carrera-prod/n02/console/carrera.war new file mode 100644 index 0000000..9b6deb9 Binary files /dev/null and b/carrera-prod/n02/console/carrera.war differ diff --git a/carrera-prod/n02/console/control.sh b/carrera-prod/n02/console/control.sh new file mode 100755 index 0000000..7f53986 --- /dev/null +++ b/carrera-prod/n02/console/control.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +WEBAPPS="/root/tomcat/webapps" +TOMCATBIN="/root/tomcat/bin" + +function start() { + OLD_PID="`pgrep -f org.apache.catalina.startup.Bootstrap`" + if [ "$OLD_PID" ]; then + echo "tomcat is already running, pid=$OLD_PID. Stop it first!" >> control.log + exit 1 + fi + + rm -rf $WEBAPPS/carrera + rm $WEBAPPS/carrera.war + cp carrera.war $WEBAPPS + $TOMCATBIN/startup.sh + echo "tomcat started" >> control.log +} + +function stop() { + if [[ `pgrep -f org.apache.catalina.startup.Bootstrap` ]]; then + pkill -9 -f org.apache.catalina.startup.Bootstrap + fi + t=0 + while [[ `pgrep -f org.apache.catalina.startup.Bootstrap` && "$t" -lt 30 ]]; do + sleep 1 + done + if [[ `pgrep -f org.apache.catalina.startup.Bootstrap` ]]; then + echo "stop tomcat failed" >> control.log + exit 1 + fi + echo "tomcat stopped" >> control.log +} + +case "$1" in + "start") + start + ;; + "stop") + stop + ;; + "reload") + stop + start + ;; + *) + echo "supporting cmd: start/stop/reload" + ;; +esac diff --git a/carrera-prod/n02/consumer/conf/carrera.yaml b/carrera-prod/n02/consumer/conf/carrera.yaml new file mode 100644 index 0000000..dee7552 --- /dev/null +++ b/carrera-prod/n02/consumer/conf/carrera.yaml @@ -0,0 +1,3 @@ +zookeeperAddr: 172.18.0.4:2181/carrera/v4/config # config zk cluster address here. +host: 172.18.0.4 # local ip +port: 9713 # thrift server port. diff --git a/carrera-prod/n02/consumer/conf/log4j2.xml b/carrera-prod/n02/consumer/conf/log4j2.xml new file mode 100644 index 0000000..f46b334 --- /dev/null +++ b/carrera-prod/n02/consumer/conf/log4j2.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n02/consumer/control.sh b/carrera-prod/n02/consumer/control.sh new file mode 100755 index 0000000..fd63113 --- /dev/null +++ b/carrera-prod/n02/consumer/control.sh @@ -0,0 +1,107 @@ +#!/bin/bash +MAINCLASS=com.xiaojukeji.carrera.cproxy.proxy.ConsumerProxyMain +CARRERA_VERSION="1.0.0-SNAPSHOT" +CONTROL_LOG="logs/control.log" + +function start() { + OLD_PID="`pgrep -f ${MAINCLASS}`" + if [ "$OLD_PID" ]; then + echo "Proxy is already running, pid=$OLD_PID. Stop it first!" + exit 1 + fi + + BASEDIR=$(dirname "$0") + cd "${BASEDIR}" + PROXY_HOME=`pwd` + mkdir -p logs/old + + CARRERA_CONFIG="${PROXY_HOME}/conf/carrera.yaml" + + # backup log + LOG_NAMES=(carrera.log drop.log error.log main.log metric.log gc.log jstat.log) + LOG_SUFFIX=$(date +%Y%m%d-%H%M%S) + for var in ${LOG_NAMES[@]}; + do + if [ -f "${PROXY_HOME}/logs/${var}" ]; then + mv "${PROXY_HOME}/logs/${var}" "${PROXY_HOME}/logs/old/${var}.${LOG_SUFFIX}" + fi + done + + # set config + LOG_BASE_CONSUMER_LEVEL="INFO" + MEM_OPTS="-Xms512m -Xmx512m" + LOG_SAVE_SIZE="1GB" + LOG_SAVE_TIME="7d" + + export LOG_SAVE_SIZE + export LOG_SAVE_TIME + export LOG_BASE_CONSUMER_LEVEL + + echo "MEM_OPTS: " ${MEM_OPTS} + echo "LOG_SAVE_SIZE="$LOG_SAVE_SIZE", LOG_SAVE_TIME="$LOG_SAVE_TIME", LOG_BASE_CONSUMER_LEVEL="$LOG_BASE_CONSUMER_LEVEL + + JVM_OPTS="${MEM_OPTS} ${JVM_OPTS} " + JVM_OPTS="${JVM_OPTS} -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=50 -XX:+UseCMSInitiatingOccupancyOnly" + JVM_OPTS="${JVM_OPTS} -XX:+PreserveFramePointer -XX:-UseBiasedLocking -XX:-OmitStackTraceInFastThrow" + JVM_OPTS="${JVM_OPTS} -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:${PROXY_HOME}/logs/gc.log" + + JAVA_OPTS="${JAVA_OPTS} -Dlog4j.configurationFile=file://${PROXY_HOME}/conf/log4j2.xml" + JAVA_OPTS="${JAVA_OPTS} -Drocketmq.client.log.loadconfig=false" + JAVA_OPTS="${JAVA_OPTS} -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector" + JAVA_OPTS="${JAVA_OPTS} -Drocketmq.client.maxTimeConsumeContinuously=1000" + + CLASSPATH="${PROXY_HOME}/carrera-consumer-${CARRERA_VERSION}-jar-with-dependencies.jar":$CLASSPATH + + CONSOLE_LOG=${PROXY_HOME}/logs/console.`date +%Y-%m-%d`.log + date >> ${CONSOLE_LOG} + + java ${JVM_OPTS} ${JAVA_OPTS} -cp ${CLASSPATH} ${MAINCLASS} ${CARRERA_CONFIG} >> ${CONSOLE_LOG} 2>&1 & + sleep 2 + date >> ${CONTROL_LOG} + PID="`pgrep -f ${MAINCLASS}`" + if [ "$PID" ]; then + echo "New Proxy is running, pid=$PID" >> ${CONTROL_LOG} + jstat -gcutil -t $PID 30s >> ${PROXY_HOME}/logs/jstat.log 2>&1 & + else + echo "Start Proxy Failed" >> ${CONTROL_LOG} + exit 1 + fi +} + +function stop() { + date >> ${CONTROL_LOG} + PID=$(pgrep -f ${MAINCLASS}) + echo "Killing Proxy =$PID" >> ${CONTROL_LOG} + pkill -f "jstat -gcutil -t $PID 30s" + pkill -f hangAlarm.sh + pkill -15 -f ${MAINCLASS} + t=0 + while [[ `pgrep -f ${MAINCLASS}` && "$t" -lt 120 ]]; do + echo "time=$t,killing `pgrep -f ${MAINCLASS}`" + t=$(($t+1)) + sleep 1 + done + if [ `pgrep -f ${MAINCLASS}` ]; then + echo "stop timeout" + echo "Stop Proxy Failed" >> ${CONTROL_LOG} + exit 1 + fi + echo "KILLED" >> ${CONTROL_LOG} +} + +case "$1" in + "start") + start + ;; + "stop") + stop + ;; + "reload") + stop + start + ;; + *) + echo "supporting cmd: start/stop/reload" + ;; +esac + diff --git a/carrera-prod/n02/namesvr/LICENSE b/carrera-prod/n02/namesvr/LICENSE new file mode 100644 index 0000000..3726172 --- /dev/null +++ b/carrera-prod/n02/namesvr/LICENSE @@ -0,0 +1,334 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (properties) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +------ +This product has a bundle logback, which is available under the EPL v1.0 License. +The source code of logback can be found at https://github.com/qos-ch/logback. + +Logback LICENSE +--------------- + +Logback: the reliable, generic, fast and flexible logging framework. +Copyright (C) 1999-2015, QOS.ch. All rights reserved. + +This program and the accompanying materials are dual-licensed under +either the terms of the Eclipse Public License v1.0 as published by +the Eclipse Foundation + + or (per the licensee's choosing) + +under the terms of the GNU Lesser General Public License version 2.1 +as published by the Free Software Foundation. + +------ +This product has a bundle slf4j, which is available under the MIT License. +The source code of slf4j can be found at https://github.com/qos-ch/slf4j. + + Copyright (c) 2004-2017 QOS.ch + All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +------ +This product has a bundle fastjson, which is available under the ASL2 License. +The source code of fastjson can be found at https://github.com/alibaba/fastjson. + + Copyright 1999-2016 Alibaba Group Holding Ltd. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +------ +This product has a bundle javassist, which is available under the ASL2 License. +The source code of javassist can be found at https://github.com/jboss-javassist/javassist. + + Copyright (C) 1999- by Shigeru Chiba, All rights reserved. + + Javassist (JAVA programming ASSISTant) makes Java bytecode manipulation simple. + It is a class library for editing bytecodes in Java; it enables Java programs to define a new class + at runtime and to modify a class file when the JVM loads it. Unlike other similar bytecode editors, + Javassist provides two levels of API: source level and bytecode level. If the users use the source- level API, + they can edit a class file without knowledge of the specifications of the Java bytecode. + The whole API is designed with only the vocabulary of the Java language. + You can even specify inserted bytecode in the form of source text; Javassist compiles it on the fly. + On the other hand, the bytecode-level API allows the users to directly edit a class file as other editors. + + This software is distributed under the Mozilla Public License Version 1.1, + the GNU Lesser General Public License Version 2.1 or later, or the Apache License Version 2.0. + +------ +This product has a bundle jna, which is available under the ASL2 License. +The source code of jna can be found at https://github.com/java-native-access/jna. + + This copy of JNA is licensed under the + Apache (Software) License, version 2.0 ("the License"). + See the License for details about distribution rights, and the + specific rights regarding derivate works. + + You may obtain a copy of the License at: + + http://www.apache.org/licenses/ + + A copy is also included in the downloadable source code package + containing JNA, in file "AL2.0", under the same directory + as this file. +------ +This product has a bundle guava, which is available under the ASL2 License. +The source code of guava can be found at https://github.com/google/guava. + + Copyright (C) 2007 The Guava authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +------ +This product has a bundle OpenMessaging, which is available under the ASL2 License. +The source code of OpenMessaging can be found at https://github.com/openmessaging/openmessaging. + + Copyright (C) 2017 The OpenMessaging authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/carrera-prod/n02/namesvr/NOTICE b/carrera-prod/n02/namesvr/NOTICE new file mode 100644 index 0000000..c91dc22 --- /dev/null +++ b/carrera-prod/n02/namesvr/NOTICE @@ -0,0 +1,36 @@ +Apache RocketMQ +Copyright 2016-2017 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +------ +This product has a bundle netty: + The Netty Project + ================= + +Please visit the Netty web site for more information: + + * http://netty.io/ + +Copyright 2014 The Netty Project + +The Netty Project licenses this file to you under the Apache License, +version 2.0 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations +under the License. + +Also, please refer to each LICENSE..txt file, which is located in +the 'license' directory of the distribution file, for the license terms of the +components that this product depends on. + +------ +This product has a bundle commons-lang, which includes software from the Spring Framework, +under the Apache License 2.0 (see: StringUtils.containsWhitespace()) \ No newline at end of file diff --git a/carrera-prod/n02/namesvr/README.md b/carrera-prod/n02/namesvr/README.md new file mode 100644 index 0000000..b86ac71 --- /dev/null +++ b/carrera-prod/n02/namesvr/README.md @@ -0,0 +1,2 @@ +## Apache RocketMQ Didi 内部分支,作为DDMQ的存储引擎之一。 + diff --git a/carrera-prod/n02/namesvr/bin/README.md b/carrera-prod/n02/namesvr/bin/README.md new file mode 100755 index 0000000..efbb67d --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/README.md @@ -0,0 +1,29 @@ +### Operating system tuning +Before deploying broker servers, it's highly recommended to run **os.sh**, which is to optimize your operating system for better performance. + +## Notice +### os.sh should be executed only once with root permission. +### os.sh parameter settings are for reference purpose only. You can tune them according to your target host configurations. + + +### Start broker +* Unix platform + + `nohup sh mqbroker &` + +### Shutdown broker + sh mqshutdown broker + +### Start Nameserver +* Unix platform + + `nohup sh mqnamesrv &` + +### Shutdown Nameserver + sh mqshutdown namesrv + +### Update or create Topic + sh mqadmin updateTopic -b 127.0.0.1:10911 -t TopicA + +### Update or create subscription group + sh mqadmin updateSubGroup -b 127.0.0.1:10911 -g SubGroupA \ No newline at end of file diff --git a/carrera-prod/n02/namesvr/bin/cachedog.sh b/carrera-prod/n02/namesvr/bin/cachedog.sh new file mode 100755 index 0000000..9329fdb --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/cachedog.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=$PATH:/sbin + +while true; do + nr_free_pages=`fgrep -A 10 Normal /proc/zoneinfo |grep nr_free_pages |awk -F ' ' '{print $2}'` + high=`fgrep -A 10 Normal /proc/zoneinfo |grep high |awk -F ' ' '{print $2}'` + + NOW_DATE=`date +%D` + NOW_TIME=`date +%T` + + if [ ${nr_free_pages} -le ${high} ]; then + sysctl -w vm.drop_caches=3 + nr_free_pages_new=`fgrep -A 10 Normal /proc/zoneinfo |grep nr_free_pages |awk -F ' ' '{print $2}'` + + printf "%s %s [CLEAN] nr_free_pages < high, clean cache. nr_free_pages=%s ====> nr_free_pages=%s\n" "${NOW_DATE}" "${NOW_TIME}" ${nr_free_pages} ${nr_free_pages_new} + + sysctl -w vm.drop_caches=1 + echo + echo + echo + else + printf "%s %s [NOTHING] nr_free_pages=%s high=%s\n" "${NOW_DATE}" "${NOW_TIME}" ${nr_free_pages} ${high} + fi + + sleep 1 +done diff --git a/carrera-prod/n02/namesvr/bin/cleancache.sh b/carrera-prod/n02/namesvr/bin/cleancache.sh new file mode 100755 index 0000000..9c6e9ab --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/cleancache.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=$PATH:/sbin + +sysctl -w vm.drop_caches=3 diff --git a/carrera-prod/n02/namesvr/bin/cleancache.v1.sh b/carrera-prod/n02/namesvr/bin/cleancache.v1.sh new file mode 100755 index 0000000..b334841 --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/cleancache.v1.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=$PATH:/sbin + +# +# GB +# +function changeFreeCache() +{ + EXTRA=$1 + MIN=$2 + sysctl -w vm.extra_free_kbytes=${EXTRA}000000 + sysctl -w vm.min_free_kbytes=${MIN}000000 +} + + +if [ $# -ne 1 ] +then + echo "Usage: $0 freecache(GB)" + echo "Example: $0 15" + exit +fi + +changeFreeCache 3 $1 +changeFreeCache 3 1 diff --git a/carrera-prod/n02/namesvr/bin/mqadmin b/carrera-prod/n02/namesvr/bin/mqadmin new file mode 100755 index 0000000..cd0253b --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/mqadmin @@ -0,0 +1,45 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +sh ${ROCKETMQ_HOME}/bin/tools.sh org.apache.rocketmq.tools.command.MQAdminStartup $@ diff --git a/carrera-prod/n02/namesvr/bin/mqadmin.cmd b/carrera-prod/n02/namesvr/bin/mqadmin.cmd new file mode 100755 index 0000000..4e061f0 --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/mqadmin.cmd @@ -0,0 +1,18 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%ROCKETMQ_HOME%\bin\tools.cmd" echo Please set the ROCKETMQ_HOME variable in your environment! & EXIT /B 1 +call "%ROCKETMQ_HOME%\bin\tools.cmd" org.apache.rocketmq.tools.command.MQAdminStartup %* \ No newline at end of file diff --git a/carrera-prod/n02/namesvr/bin/mqadmin.xml b/carrera-prod/n02/namesvr/bin/mqadmin.xml new file mode 100755 index 0000000..0f07da4 --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/mqadmin.xml @@ -0,0 +1,43 @@ + + + + false + + ${JAVA_HOME} + + server + + org.apache.rocketmq.tools.command.MQAdminStartup + + + ${cpd}/../lib + ${cpd}/.. + + + + + + + <-Xms512m> + <-Xmx1g> + <-XX:NewSize>256M + <-XX:MaxNewSize>512M + <-XX:PermSize>128M + <-XX:MaxPermSize>128M + + diff --git a/carrera-prod/n02/namesvr/bin/mqbroker b/carrera-prod/n02/namesvr/bin/mqbroker new file mode 100755 index 0000000..6a79c39 --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/mqbroker @@ -0,0 +1,45 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +sh ${ROCKETMQ_HOME}/bin/runbroker.sh org.apache.rocketmq.broker.BrokerStartup $@ diff --git a/carrera-prod/n02/namesvr/bin/mqbroker.cmd b/carrera-prod/n02/namesvr/bin/mqbroker.cmd new file mode 100755 index 0000000..3efb475 --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/mqbroker.cmd @@ -0,0 +1,23 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%ROCKETMQ_HOME%\bin\runbroker.cmd" echo Please set the ROCKETMQ_HOME variable in your environment! & EXIT /B 1 + +call "%ROCKETMQ_HOME%\bin\runbroker.cmd" org.apache.rocketmq.broker.BrokerStartup %* + +IF %ERRORLEVEL% EQU 0 ( + ECHO "Broker starts OK" +) \ No newline at end of file diff --git a/carrera-prod/n02/namesvr/bin/mqbroker.numanode0 b/carrera-prod/n02/namesvr/bin/mqbroker.numanode0 new file mode 100755 index 0000000..b7486a7 --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/mqbroker.numanode0 @@ -0,0 +1,47 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +export RMQ_NUMA_NODE=0 + +sh ${ROCKETMQ_HOME}/bin/mqbroker $@ diff --git a/carrera-prod/n02/namesvr/bin/mqbroker.numanode1 b/carrera-prod/n02/namesvr/bin/mqbroker.numanode1 new file mode 100755 index 0000000..c301fed --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/mqbroker.numanode1 @@ -0,0 +1,47 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +export RMQ_NUMA_NODE=1 + +sh ${ROCKETMQ_HOME}/bin/mqbroker $@ diff --git a/carrera-prod/n02/namesvr/bin/mqbroker.numanode2 b/carrera-prod/n02/namesvr/bin/mqbroker.numanode2 new file mode 100755 index 0000000..ea95304 --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/mqbroker.numanode2 @@ -0,0 +1,47 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +export RMQ_NUMA_NODE=2 + +sh ${ROCKETMQ_HOME}/bin/mqbroker $@ diff --git a/carrera-prod/n02/namesvr/bin/mqbroker.numanode3 b/carrera-prod/n02/namesvr/bin/mqbroker.numanode3 new file mode 100755 index 0000000..25d3d1d --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/mqbroker.numanode3 @@ -0,0 +1,47 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +export RMQ_NUMA_NODE=3 + +sh ${ROCKETMQ_HOME}/bin/mqbroker $@ diff --git a/carrera-prod/n02/namesvr/bin/mqbroker.xml b/carrera-prod/n02/namesvr/bin/mqbroker.xml new file mode 100755 index 0000000..3043cc0 --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/mqbroker.xml @@ -0,0 +1,45 @@ + + + + false + + ${JAVA_HOME} + + server + + org.apache.rocketmq.broker.BrokerStartup + + + ${cpd}/../lib + ${cpd}/.. + + + + + + + <-Xms512m> + + <-Xmx1g> + +<-XX:NewSize>256M +<-XX:MaxNewSize>512M +<-XX:PermSize>128M +<-XX:MaxPermSize>128M + + diff --git a/carrera-prod/n02/namesvr/bin/mqfiltersrv b/carrera-prod/n02/namesvr/bin/mqfiltersrv new file mode 100755 index 0000000..2fd0cbe --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/mqfiltersrv @@ -0,0 +1,45 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +sh ${ROCKETMQ_HOME}/bin/runserver.sh org.apache.rocketmq.filtersrv.FiltersrvStartup $@ diff --git a/carrera-prod/n02/namesvr/bin/mqfiltersrv.cmd b/carrera-prod/n02/namesvr/bin/mqfiltersrv.cmd new file mode 100755 index 0000000..0503026 --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/mqfiltersrv.cmd @@ -0,0 +1,23 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%ROCKETMQ_HOME%\bin\runbroker.cmd" echo Please set the ROCKETMQ_HOME variable in your environment! & EXIT /B 1 + +call "%ROCKETMQ_HOME%\bin\runserver.cmd" org.apache.rocketmq.filtersrv.FiltersrvStartup %* + +IF %ERRORLEVEL% EQU 0 ( + ECHO "Filtersrv starts OK" +) \ No newline at end of file diff --git a/carrera-prod/n02/namesvr/bin/mqfiltersrv.xml b/carrera-prod/n02/namesvr/bin/mqfiltersrv.xml new file mode 100755 index 0000000..dc36a8d --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/mqfiltersrv.xml @@ -0,0 +1,45 @@ + + + + false + + ${JAVA_HOME} + + server + + org.apache.rocketmq.filtersrv.FiltersrvStartup + + + ${cpd}/../lib + ${cpd}/.. + + + + + + + <-Xms512m> + + <-Xmx1g> + +<-XX:NewSize>256M +<-XX:MaxNewSize>512M +<-XX:PermSize>128M +<-XX:MaxPermSize>128M + + diff --git a/carrera-prod/n02/namesvr/bin/mqnamesrv b/carrera-prod/n02/namesvr/bin/mqnamesrv new file mode 100755 index 0000000..c1e70bd --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/mqnamesrv @@ -0,0 +1,45 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +sh ${ROCKETMQ_HOME}/bin/runserver.sh org.apache.rocketmq.namesrv.NamesrvStartup $@ diff --git a/carrera-prod/n02/namesvr/bin/mqnamesrv.cmd b/carrera-prod/n02/namesvr/bin/mqnamesrv.cmd new file mode 100755 index 0000000..2828bdc --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/mqnamesrv.cmd @@ -0,0 +1,23 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%ROCKETMQ_HOME%\bin\runserver.cmd" echo Please set the ROCKETMQ_HOME variable in your environment! & EXIT /B 1 + +call "%ROCKETMQ_HOME%\bin\runserver.cmd" org.apache.rocketmq.namesrv.NamesrvStartup %* + +IF %ERRORLEVEL% EQU 0 ( + ECHO "Namesrv starts OK" +) \ No newline at end of file diff --git a/carrera-prod/n02/namesvr/bin/mqnamesrv.xml b/carrera-prod/n02/namesvr/bin/mqnamesrv.xml new file mode 100755 index 0000000..1f050d1 --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/mqnamesrv.xml @@ -0,0 +1,45 @@ + + + + false + + ${JAVA_HOME} + + server + + org.apache.rocketmq.namesrv.NamesrvStartup + + + ${cpd}/../lib + ${cpd}/.. + + + + + + + <-Xms512m> + + <-Xmx1g> + +<-XX:NewSize>256M +<-XX:MaxNewSize>512M +<-XX:PermSize>128M +<-XX:MaxPermSize>128M + + diff --git a/carrera-prod/n02/namesvr/bin/mqshutdown b/carrera-prod/n02/namesvr/bin/mqshutdown new file mode 100755 index 0000000..d2d51fc --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/mqshutdown @@ -0,0 +1,49 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +case $1 in + broker) + + pid=`ps ax | grep -i 'org.apache.rocketmq.broker.BrokerStartup' |grep java | grep -v grep | awk '{print $1}'` + if [ -z "$pid" ] ; then + echo "No mqbroker running." + exit -1; + fi + + echo "The mqbroker(${pid}) is running..." + + kill ${pid} + + echo "Send shutdown request to mqbroker(${pid}) OK" + ;; + namesrv) + + pid=`ps ax | grep -i 'org.apache.rocketmq.namesrv.NamesrvStartup' |grep java | grep -v grep | awk '{print $1}'` + if [ -z "$pid" ] ; then + echo "No mqnamesrv running." + exit -1; + fi + + echo "The mqnamesrv(${pid}) is running..." + + kill ${pid} + + echo "Send shutdown request to mqnamesrv(${pid}) OK" + ;; + *) + echo "Useage: mqshutdown broker | namesrv" +esac diff --git a/carrera-prod/n02/namesvr/bin/mqshutdown.cmd b/carrera-prod/n02/namesvr/bin/mqshutdown.cmd new file mode 100755 index 0000000..50af026 --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/mqshutdown.cmd @@ -0,0 +1,35 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%JAVA_HOME%\bin\jps.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! & EXIT /B 1 + +setlocal + +set "PATH=%JAVA_HOME%\bin;%PATH%" + +if /I "%1" == "broker" ( + echo killing broker + for /f "tokens=1" %%i in ('jps -m ^| find "BrokerStartup"') do ( taskkill /F /PID %%i ) + echo Done! +) else if /I "%1" == "namesrv" ( + echo killing name server + + for /f "tokens=1" %%i in ('jps -m ^| find "NamesrvStartup"') do ( taskkill /F /PID %%i ) + + echo Done! +) else ( + echo Unknown role to kill, please specify broker or namesrv +) \ No newline at end of file diff --git a/carrera-prod/n02/namesvr/bin/os.sh b/carrera-prod/n02/namesvr/bin/os.sh new file mode 100755 index 0000000..cb5cf05 --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/os.sh @@ -0,0 +1,67 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=$PATH:/sbin + +HOME="/home/xiaoju" +if [ -d ${HOME}/tmpfs ] ; then + echo "tmpfs exist, do nothing." +else + ln -s /dev/shm ${HOME}/tmpfs + echo "create tmpfs ok" +fi + +# sudo sysctl -w vm.extra_free_kbytes=2000000 +# sudo sysctl -w vm.min_free_kbytes=1000000 +sudo sysctl -w vm.overcommit_memory=1 +sudo sysctl -w vm.drop_caches=1 +sudo sysctl -w vm.zone_reclaim_mode=0 +sudo sysctl -w vm.max_map_count=655360 +sudo sysctl -w vm.dirty_background_ratio=50 +sudo sysctl -w vm.dirty_ratio=50 +sudo sysctl -w vm.dirty_writeback_centisecs=360000 +sudo sysctl -w vm.page-cluster=3 +sudo sysctl -w vm.swappiness=1 + +echo 'ulimit -n 655350' >> /etc/profile +echo '* hard nofile 655350' >> /etc/security/limits.conf + +echo '* hard memlock unlimited' >> /etc/security/limits.conf +echo '* soft memlock unlimited' >> /etc/security/limits.conf + +DISK=`df -k | sort -n -r -k 2 | awk -F/ 'NR==1 {gsub(/[0-9].*/,"",$3); print $3}'` +[ "$DISK" = 'cciss' ] && DISK='cciss!c0d0' +echo 'deadline' > /sys/block/${DISK}/queue/scheduler + + +echo "---------------------------------------------------------------" +sysctl vm.extra_free_kbytes +sysctl vm.min_free_kbytes +sysctl vm.overcommit_memory +sysctl vm.drop_caches +sysctl vm.zone_reclaim_mode +sysctl vm.max_map_count +sysctl vm.dirty_background_ratio +sysctl vm.dirty_ratio +sysctl vm.dirty_writeback_centisecs +sysctl vm.page-cluster +sysctl vm.swappiness + +#su - admin -c 'ulimit -n' +ulimit -n +cat /sys/block/$DISK/queue/scheduler + diff --git a/carrera-prod/n02/namesvr/bin/play.cmd b/carrera-prod/n02/namesvr/bin/play.cmd new file mode 100755 index 0000000..f1737d5 --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/play.cmd @@ -0,0 +1,30 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +START /B mqnamesrv > ns.log 2>&1 +IF %ERRORLEVEL% NEQ 0 ( + echo "Failed to start name server. Please check ns.log" + EXIT /B 1 +) + +START /B mqbroker -n localhost:9876 > bk.log 2>&1 + +IF %ERRORLEVEL% NEQ 0 ( + ECHO "Failed to start broker. Please check bk.log" + EXIT /B 1 +) + +echo "Start Name Server and Broker Successfully." \ No newline at end of file diff --git a/carrera-prod/n02/namesvr/bin/play.sh b/carrera-prod/n02/namesvr/bin/play.sh new file mode 100755 index 0000000..359d18d --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/play.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Name Server +# +nohup sh mqnamesrv > ns.log 2>&1 & + +# +# Service Addr +# +ADDR=`hostname -i`:9876 + +# +# Broker +# +nohup sh mqbroker -n ${ADDR} > bk.log 2>&1 & + +echo "Start Name Server and Broker Successfully, ${ADDR}" diff --git a/carrera-prod/n02/namesvr/bin/runbroker b/carrera-prod/n02/namesvr/bin/runbroker new file mode 100755 index 0000000..538f8e1 --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/runbroker @@ -0,0 +1,15 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. diff --git a/carrera-prod/n02/namesvr/bin/runbroker.cmd b/carrera-prod/n02/namesvr/bin/runbroker.cmd new file mode 100755 index 0000000..eab7e30 --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/runbroker.cmd @@ -0,0 +1,42 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%JAVA_HOME%\bin\java.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! & EXIT /B 1 +set "JAVA=%JAVA_HOME%\bin\java.exe" + +setlocal + +set BASE_DIR=%~dp0 +set BASE_DIR=%BASE_DIR:~0,-1% +for %%d in (%BASE_DIR%) do set BASE_DIR=%%~dpd + +set CLASSPATH=.;%BASE_DIR%conf;%CLASSPATH% + +rem =========================================================================================== +rem JVM Configuration +rem =========================================================================================== +set "JAVA_OPT=%JAVA_OPT% -server -Xms2g -Xmx2g -Xmn1g" +set "JAVA_OPT=%JAVA_OPT% -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0 -XX:SurvivorRatio=8" +set "JAVA_OPT=%JAVA_OPT% -verbose:gc -Xloggc:%USERPROFILE%\mq_gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintAdaptiveSizePolicy" +set "JAVA_OPT=%JAVA_OPT% -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=30m" +set "JAVA_OPT=%JAVA_OPT% -XX:-OmitStackTraceInFastThrow" +set "JAVA_OPT=%JAVA_OPT% -XX:+AlwaysPreTouch" +set "JAVA_OPT=%JAVA_OPT% -XX:MaxDirectMemorySize=15g" +set "JAVA_OPT=%JAVA_OPT% -XX:-UseLargePages -XX:-UseBiasedLocking" +set "JAVA_OPT=%JAVA_OPT% -Djava.ext.dirs=%BASE_DIR%lib" +set "JAVA_OPT=%JAVA_OPT% -cp %CLASSPATH%" + +"%JAVA%" %JAVA_OPT% %* \ No newline at end of file diff --git a/carrera-prod/n02/namesvr/bin/runbroker.sh b/carrera-prod/n02/namesvr/bin/runbroker.sh new file mode 100755 index 0000000..6898875 --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/runbroker.sh @@ -0,0 +1,61 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#=========================================================================================== +# Java Environment Setting +#=========================================================================================== +error_exit () +{ + echo "ERROR: $1 !!" + exit 1 +} + +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java +[ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)!" + +export JAVA_HOME +export JAVA="$JAVA_HOME/bin/java" +export BASE_DIR=$(dirname $0)/.. +export CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH} + +#=========================================================================================== +# JVM Configuration +#=========================================================================================== +JAVA_OPT="${JAVA_OPT} -server -Xms512m -Xmx512m -Xmn512m" +JAVA_OPT="${JAVA_OPT} -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0 -XX:SurvivorRatio=8" +JAVA_OPT="${JAVA_OPT} -verbose:gc -Xloggc:/dev/shm/mq_gc_%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintAdaptiveSizePolicy" +JAVA_OPT="${JAVA_OPT} -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=30m" +JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow" +JAVA_OPT="${JAVA_OPT} -XX:+AlwaysPreTouch" +JAVA_OPT="${JAVA_OPT} -XX:MaxDirectMemorySize=512m" +JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages -XX:-UseBiasedLocking" +JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${BASE_DIR}/lib" +JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}" +JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}" + +numactl --interleave=all pwd > /dev/null 2>&1 +if [ $? -eq 0 ] +then + if [ -z "$RMQ_NUMA_NODE" ] ; then + numactl --interleave=all $JAVA ${JAVA_OPT} $@ + else + numactl --cpunodebind=$RMQ_NUMA_NODE --membind=$RMQ_NUMA_NODE $JAVA ${JAVA_OPT} $@ + fi +else + $JAVA ${JAVA_OPT} $@ +fi diff --git a/carrera-prod/n02/namesvr/bin/runserver.cmd b/carrera-prod/n02/namesvr/bin/runserver.cmd new file mode 100755 index 0000000..48e32bf --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/runserver.cmd @@ -0,0 +1,37 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + + +if not exist "%JAVA_HOME%\bin\java.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! & EXIT /B 1 +set "JAVA=%JAVA_HOME%\bin\java.exe" + +setlocal + +set BASE_DIR=%~dp0 +set BASE_DIR=%BASE_DIR:~0,-1% +for %%d in (%BASE_DIR%) do set BASE_DIR=%%~dpd + +set CLASSPATH=.;%BASE_DIR%conf;%CLASSPATH% + +set "JAVA_OPT=%JAVA_OPT% -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m" +set "JAVA_OPT=%JAVA_OPT% -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 -XX:-UseParNewGC" +set "JAVA_OPT=%JAVA_OPT% -verbose:gc -Xloggc:"%USERPROFILE%\rmq_srv_gc.log" -XX:+PrintGCDetails" +set "JAVA_OPT=%JAVA_OPT% -XX:-OmitStackTraceInFastThrow" +set "JAVA_OPT=%JAVA_OPT% -XX:-UseLargePages" +set "JAVA_OPT=%JAVA_OPT% -Djava.ext.dirs=%BASE_DIR%lib" +set "JAVA_OPT=%JAVA_OPT% -cp "%CLASSPATH%"" + +"%JAVA%" %JAVA_OPT% %* \ No newline at end of file diff --git a/carrera-prod/n02/namesvr/bin/runserver.sh b/carrera-prod/n02/namesvr/bin/runserver.sh new file mode 100755 index 0000000..c5b9aad --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/runserver.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#=========================================================================================== +# Java Environment Setting +#=========================================================================================== +error_exit () +{ + echo "ERROR: $1 !!" + exit 1 +} + +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java +[ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)!" + +export JAVA_HOME +export JAVA="$JAVA_HOME/bin/java" +export BASE_DIR=$(dirname $0)/.. +export CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH} + +#=========================================================================================== +# JVM Configuration +#=========================================================================================== +JAVA_OPT="${JAVA_OPT} -server -Xms128m -Xmx128m -Xmn128m -XX:MetaspaceSize=32m -XX:MaxMetaspaceSize=32m" +JAVA_OPT="${JAVA_OPT} -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 -XX:-UseParNewGC" +JAVA_OPT="${JAVA_OPT} -verbose:gc -Xloggc:/dev/shm/rmq_srv_gc.log -XX:+PrintGCDetails" +JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow" +JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages" +JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${BASE_DIR}/lib" +#JAVA_OPT="${JAVA_OPT} -Xdebug -Xrunjdwp:transport=dt_socket,address=9555,server=y,suspend=n" +JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}" +JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}" + +$JAVA ${JAVA_OPT} $@ diff --git a/carrera-prod/n02/namesvr/bin/setcache.sh b/carrera-prod/n02/namesvr/bin/setcache.sh new file mode 100755 index 0000000..27633f3 --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/setcache.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export PATH=$PATH:/sbin + +# +# GB +# +function changeFreeCache() +{ + EXTRA=$1 + MIN=$2 + sysctl -w vm.extra_free_kbytes=${EXTRA}000000 + sysctl -w vm.min_free_kbytes=${MIN}000000 + sysctl -w vm.swappiness=0 +} + + +if [ $# -ne 2 ] +then + echo "Usage: $0 extra_free_kbytes(GB) min_free_kbytes(GB)" + echo "Example: $0 3 1" + exit +fi + +changeFreeCache $1 $2 diff --git a/carrera-prod/n02/namesvr/bin/startfsrv.sh b/carrera-prod/n02/namesvr/bin/startfsrv.sh new file mode 100755 index 0000000..f7ba188 --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/startfsrv.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +nohup sh ${ROCKETMQ_HOME}/bin/runserver.sh org.apache.rocketmq.filtersrv.FiltersrvStartup $@ & diff --git a/carrera-prod/n02/namesvr/bin/tools.cmd b/carrera-prod/n02/namesvr/bin/tools.cmd new file mode 100755 index 0000000..28ce765 --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/tools.cmd @@ -0,0 +1,35 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if not exist "%JAVA_HOME%\bin\java.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! & EXIT /B 1 + +set "JAVA=%JAVA_HOME%\bin\java.exe" + +setlocal +set BASE_DIR=%~dp0 +set BASE_DIR=%BASE_DIR:~0,-1% +for %%d in (%BASE_DIR%) do set BASE_DIR=%%~dpd + +set CLASSPATH=.;%BASE_DIR%conf;%CLASSPATH% + +rem =========================================================================================== +rem JVM Configuration +rem =========================================================================================== +set "JAVA_OPT=%JAVA_OPT% -server -Xms1g -Xmx1g -Xmn256m -XX:PermSize=128m -XX:MaxPermSize=128m" +set "JAVA_OPT=%JAVA_OPT% -Djava.ext.dirs="%BASE_DIR%\lib";"%JAVA_HOME%\jre\lib\ext"" +set "JAVA_OPT=%JAVA_OPT% -cp "%CLASSPATH%"" + +"%JAVA%" %JAVA_OPT% %* \ No newline at end of file diff --git a/carrera-prod/n02/namesvr/bin/tools.sh b/carrera-prod/n02/namesvr/bin/tools.sh new file mode 100755 index 0000000..e0c840c --- /dev/null +++ b/carrera-prod/n02/namesvr/bin/tools.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#=========================================================================================== +# Java Environment Setting +#=========================================================================================== +error_exit () +{ + echo "ERROR: $1 !!" + exit 1 +} + +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java +[ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)!" + +export JAVA_HOME +export JAVA="$JAVA_HOME/bin/java" +export BASE_DIR=$(dirname $0)/.. +export CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH} + +#=========================================================================================== +# JVM Configuration +#=========================================================================================== +JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn256m" +JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${BASE_DIR}/lib:${JAVA_HOME}/jre/lib/ext" +JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}" + +$JAVA ${JAVA_OPT} $@ diff --git a/carrera-prod/n02/namesvr/conf/logback_broker.xml b/carrera-prod/n02/namesvr/conf/logback_broker.xml new file mode 100644 index 0000000..d15c205 --- /dev/null +++ b/carrera-prod/n02/namesvr/conf/logback_broker.xml @@ -0,0 +1,337 @@ + + + + + + ${user.home}/logs/rocketmqlogs/broker_default.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/broker_default.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + ${user.home}/logs/rocketmqlogs/broker.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/broker.%i.log.gz + 1 + 20 + + + 128MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/protection.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/protection.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/watermark.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/watermark.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/store.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/store.%i.log.gz + 1 + 10 + + + 128MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/remoting.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/remoting.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/storeerror.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/storeerror.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + + ${user.home}/logs/rocketmqlogs/transaction.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/transaction.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/lock.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/lock.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/filter.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/filter.%i.log.gz + 1 + 10 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + ${user.home}/logs/rocketmqlogs/stats.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/stats.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p - %m%n + UTF-8 + + + + + ${user.home}/logs/rocketmqlogs/commercial.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/commercial.%i.log.gz + 1 + 10 + + + 500MB + + + + + true + + %d{yyy-MM-dd HH\:mm\:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n02/namesvr/conf/logback_filtersrv.xml b/carrera-prod/n02/namesvr/conf/logback_filtersrv.xml new file mode 100644 index 0000000..71b9a93 --- /dev/null +++ b/carrera-prod/n02/namesvr/conf/logback_filtersrv.xml @@ -0,0 +1,87 @@ + + + + + + ${user.home}/logs/rocketmqlogs/filtersrv_default.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/filtersrv_default.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + ${user.home}/logs/rocketmqlogs/filtersrv.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/filtersrv.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + 0 + + + + true + + %d{yyy-MM-dd HH\:mm\:ss,SSS} %p %t - %m%n + UTF-8 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n02/namesvr/conf/logback_namesrv.xml b/carrera-prod/n02/namesvr/conf/logback_namesrv.xml new file mode 100644 index 0000000..c68c8b6 --- /dev/null +++ b/carrera-prod/n02/namesvr/conf/logback_namesrv.xml @@ -0,0 +1,89 @@ + + + + + + ${user.home}/logs/rocketmqlogs/namesrv_default.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/namesrv_default.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + ${user.home}/logs/rocketmqlogs/namesrv.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/namesrv.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss.SSS,GMT+8} %p %t - %m%n + UTF-8 + + + + + 0 + + + + true + + %d{yyy-MM-dd HH\:mm\:ss,SSS} %p %t - %m%n + UTF-8 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n02/namesvr/conf/logback_tools.xml b/carrera-prod/n02/namesvr/conf/logback_tools.xml new file mode 100644 index 0000000..28283ad --- /dev/null +++ b/carrera-prod/n02/namesvr/conf/logback_tools.xml @@ -0,0 +1,93 @@ + + + + + + ${user.home}/logs/rocketmqlogs/tools_default.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/tools_default.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + ${user.home}/logs/rocketmqlogs/tools.log + true + + ${user.home}/logs/rocketmqlogs/otherdays/tools.%i.log.gz + 1 + 5 + + + 100MB + + + %d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + + true + + %d{yyy-MM-dd HH\:mm\:ss,GMT+8} %p %t - %m%n + UTF-8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n02/namesvr/control.sh b/carrera-prod/n02/namesvr/control.sh new file mode 100755 index 0000000..d3a5d29 --- /dev/null +++ b/carrera-prod/n02/namesvr/control.sh @@ -0,0 +1,76 @@ +#!/bin/bash + +MAIN_CLASS=rocketmq.namesrv.NamesrvStartup + +function get_pid() { + PID=$(ps ax | grep -i ${MAIN_CLASS} |grep java | grep -v grep | awk '{print $1}') +} + +function start() { + get_pid + if [ ! -z "$PID" ] ; then + echo "Shutdown old process($MAIN_CLASS) first, pid=${PID}" + exit 1 + fi + + nohup sh bin/mqnamesrv >> ns.log 2>&1 & + echo "running: nohup sh bin/mqnamesrv >> ns.log 2>&1 &" + + get_pid + t=0 + while [[ -z ${PID} && "$t" -lt 10 ]]; do + echo "time=$t,starting process($MAIN_CLASS)" + get_pid + t=$(($t+1)) + sleep 0.5 + done + + if [ -z ${PID} ]; then + echo "start process($MAIN_CLASS) failed!!!" + exit 1 + else + echo "start process($MAIN_CLASS) success, pid=${PID}" + fi +} + +function stop() { + get_pid + if [ -z "$PID" ] ; then + echo "no process running..." + else + echo "killing process($MAIN_CLASS), pid=${PID}" + kill ${PID} + fi + + t=0 + while [[ ! -z ${PID} && "$t" -lt 60 ]]; do + echo "time=$t,killing process($MAIN_CLASS), pid=${PID}" + get_pid + t=$(($t+1)) + sleep 1 + done + + if [ ! -z ${PID} ]; then + echo "killing process($MAIN_CLASS), pid=${PID}" + exit 1 + fi +} + +workspace=$(cd $(dirname $0) && pwd -P) +cd ${workspace} + +case "$1" in + "start") + start + ;; + "stop") + stop + ;; + "reload") + stop + start + ;; + *) + echo "supporting cmd: start/stop/reload" + ;; +esac diff --git a/carrera-prod/n02/producer/conf/carrera.yaml b/carrera-prod/n02/producer/conf/carrera.yaml new file mode 100644 index 0000000..ac67c1f --- /dev/null +++ b/carrera-prod/n02/producer/conf/carrera.yaml @@ -0,0 +1,3 @@ +zookeeperAddr: 172.18.0.4:2181/carrera/v4/config # config zk cluster address here. +host: 172.18.0.4 # local ip +port: 9613 # thrift server port. diff --git a/carrera-prod/n02/producer/conf/log4j2.xml b/carrera-prod/n02/producer/conf/log4j2.xml new file mode 100644 index 0000000..fd35d3e --- /dev/null +++ b/carrera-prod/n02/producer/conf/log4j2.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n02/producer/control.sh b/carrera-prod/n02/producer/control.sh new file mode 100755 index 0000000..430e628 --- /dev/null +++ b/carrera-prod/n02/producer/control.sh @@ -0,0 +1,106 @@ +#!/bin/bash +MAINCLASS=com.xiaojukeji.carrera.pproxy.proxy.ProducerProxyMain +PROXY_VERSION=1.0.0-SNAPSHOT +CONTROL_LOG="logs/control.log" + +function start() { + OLD_PID="`pgrep -f ${MAINCLASS}`" + if [ "$OLD_PID" ]; then + echo "Proxy is already running, pid=$OLD_PID. Stop it first!" + exit 1 + fi + + BASEDIR=$(dirname "$0") + cd "${BASEDIR}" + PROXY_HOME=`pwd` + mkdir -p logs/old + + CARRERA_CONFIG="${PROXY_HOME}/conf/carrera.yaml" + + # backup log + LOG_NAMES=(carrera.log drop.log error.log metric.log gc.log rocketmq.log) + LOG_SUFFIX=$(date +%Y%m%d-%H%M%S) + for var in ${LOG_NAMES[@]}; + do + if [ -f "${PROXY_HOME}/logs/${var}" ]; then + mv "${PROXY_HOME}/logs/${var}" "${PROXY_HOME}/logs/old/${var}.${LOG_SUFFIX}" + fi + done + + # set config + LOG_CARRERA_LEVEL="INFO" + LOG_BATCH_LEVEL="INFO" + MEM_OPTS="-Xms256m -Xmx256m -Xmn256m" + LOG_SAVE_SIZE="1G" + LOG_SAVE_TIME="7d" + + export LOG_SAVE_SIZE + export LOG_SAVE_TIME + export LOG_CARRERA_LEVEL + export LOG_BATCH_LEVEL + + echo "MEM_OPTS: " ${MEM_OPTS} + echo "LOG_SAVE_SIZE="$LOG_SAVE_SIZE", LOG_SAVE_TIME="$LOG_SAVE_TIME", LOG_CARRERA_LEVEL="$LOG_CARRERA_LEVEL", LOG_BATCH_LEVEL="$LOG_BATCH_LEVEL + + JVM_OPTS="${MEM_OPTS} ${JVM_OPTS} " + JVM_OPTS="${JVM_OPTS} -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=50 -XX:+UseCMSInitiatingOccupancyOnly" + JVM_OPTS="${JVM_OPTS} -XX:+PreserveFramePointer -XX:-UseBiasedLocking -XX:-OmitStackTraceInFastThrow" + JVM_OPTS="${JVM_OPTS} -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:${PROXY_HOME}/logs/gc.log" + JVM_OPTS="${JVM_OPTS} -XX:+PrintSafepointStatistics" + + JAVA_OPTS="${JAVA_OPTS} -Dlog4j.configurationFile=file://${PROXY_HOME}/conf/log4j2.xml" + JAVA_OPTS="${JAVA_OPTS} -Drocketmq.client.log.loadconfig=false" + JAVA_OPTS="${JAVA_OPTS} -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector" + + CLASSPATH="${PROXY_HOME}/carrera-producer-${PROXY_VERSION}-jar-with-dependencies.jar":${CLASSPATH} + + CONSOLE_LOG=${PROXY_HOME}/logs/console.`date +%Y-%m-%d`.log + date >> ${CONSOLE_LOG} + + java ${JVM_OPTS} ${JAVA_OPTS} -cp ${CLASSPATH} ${MAINCLASS} ${CARRERA_CONFIG} >> ${CONSOLE_LOG} 2>&1 & + sleep 2 + date >> ${CONTROL_LOG} + PID="`pgrep -f ${MAINCLASS}`" + if [ "$PID" ]; then + echo "New Proxy is running, pid=$PID" >> ${CONTROL_LOG} + else + echo "Start Proxy Failed" >> ${CONTROL_LOG} + exit 1 + fi +} + +function stop() { + mkdir -p logs + date >> logs/control.log + echo "Killing Proxy =`pgrep -f ${MAINCLASS}`" >> ${CONTROL_LOG} + pkill -15 -f ${MAINCLASS} + t=0 + while [[ `pgrep -f ${MAINCLASS}` && "$t" -lt 60 ]]; do + echo "time=$t,killing `pgrep -f ${MAINCLASS}`" + t=$(($t+1)) + sleep 1 + done + if [ `pgrep -f ${MAINCLASS}` ]; then + echo "Stop Proxy Failed" >> ${CONTROL_LOG} + exit 1 + fi + echo "KILLED" >> ${CONTROL_LOG} +} + + +case "$1" in + "start") + start + ;; + "stop") + stop + ;; + "reload") + stop + start + ;; + *) + echo "supporting cmd: start/stop/reload" + ;; +esac + diff --git a/carrera-prod/n02/start.sh b/carrera-prod/n02/start.sh new file mode 100644 index 0000000..8920499 --- /dev/null +++ b/carrera-prod/n02/start.sh @@ -0,0 +1,16 @@ + +sh /root/zookeeper/bin/zkServer.sh start +cd /root/console && sh ./control.sh start + +while ! nc -z localhost 8080; do + sleep 0.1 +done + +curl http://localhost:8080/carrera/api/odin/internal/v4/initZkPath +curl http://localhost:8080/carrera/api/odin/internal/v4/initAllZk + +cd /root/namesvr && sh ./control.sh start +cd /root/broker && sh ./control.sh start + +cd /root/consumer && sh ./control.sh start +cd /root/producer && sh ./control.sh start \ No newline at end of file diff --git a/carrera-prod/n02/stop.sh b/carrera-prod/n02/stop.sh new file mode 100644 index 0000000..8ddb64a --- /dev/null +++ b/carrera-prod/n02/stop.sh @@ -0,0 +1,9 @@ + +sh /root/zookeeper/bin/zkServer.sh stop +cd /root/console && sh ./control.sh stop + +cd /root/namesvr && sh ./control.sh stop +cd /root/broker && sh ./control.sh stop + +cd /root/consumer && sh ./control.sh stop +cd /root/producer && sh ./control.sh stop \ No newline at end of file diff --git a/carrera-prod/n03/Dockerfile b/carrera-prod/n03/Dockerfile new file mode 100644 index 0000000..cf35c00 --- /dev/null +++ b/carrera-prod/n03/Dockerfile @@ -0,0 +1,54 @@ +FROM centos:7 + +## Ports +EXPOSE 9613 +EXPOSE 9713 +EXPOSE 8080 +EXPOSE 2181 + +# Env +ENV HOME_DIR /root +ENV HOME /root + +WORKDIR ${HOME_DIR} + +RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ + && echo 'Asia/Shanghai' >/etc/timezone + +RUN yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel unzip gettext nmap-ncat openssl wget telnet\ + && yum clean all -y + +RUN curl http://mirror.bit.edu.cn/apache/tomcat/tomcat-9/v9.0.24/bin/apache-tomcat-9.0.24.zip -o tomcat.zip \ + && unzip tomcat.zip \ + && mv apache-tomcat-9.0.24 tomcat \ + && rm tomcat.zip \ + && chmod +x tomcat/bin/*.sh + +RUN curl http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz -o zookeeper-3.4.10.tar.gz \ + && tar xzvf zookeeper-3.4.10.tar.gz \ + && mv zookeeper-3.4.10 zookeeper \ + && rm zookeeper-3.4.10.tar.gz \ + && cp zookeeper/conf/zoo_sample.cfg zookeeper/conf/zoo.cfg \ + && echo "dataDir=/root/zookeeper/data" >> zookeeper/conf/zoo.cfg \ + && echo "server.1=172.18.0.3:2888:3888" >> zookeeper/conf/zoo.cfg \ + && echo "server.2=172.18.0.4:2888:3888" >> zookeeper/conf/zoo.cfg \ + && echo "server.3=172.18.0.5:2888:3888" >> zookeeper/conf/zoo.cfg \ + && mkdir zookeeper/data \ + && echo '3' > zookeeper/data/myid + +RUN mkdir -p \ + /root/logs/rocketmqlogs \ + /root/chronos-storage/rocksdb \ + /root/chronos-storage/seektimestamp \ + /root/chronos-storage/rocksdb_backup \ + /root/chronos-storage/rocksdb_restore + +# copy +COPY console ${HOME_DIR}/console +COPY consumer ${HOME_DIR}/consumer +COPY producer ${HOME_DIR}/producer +COPY start.sh ${HOME_DIR}/start.sh +COPY stop.sh ${HOME_DIR}/stop.sh + +# cmd +CMD bash -C '/root/start.sh';'bash' diff --git a/carrera-prod/n03/console/carrera.war b/carrera-prod/n03/console/carrera.war new file mode 100644 index 0000000..9b6deb9 Binary files /dev/null and b/carrera-prod/n03/console/carrera.war differ diff --git a/carrera-prod/n03/console/control.sh b/carrera-prod/n03/console/control.sh new file mode 100755 index 0000000..7f53986 --- /dev/null +++ b/carrera-prod/n03/console/control.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +WEBAPPS="/root/tomcat/webapps" +TOMCATBIN="/root/tomcat/bin" + +function start() { + OLD_PID="`pgrep -f org.apache.catalina.startup.Bootstrap`" + if [ "$OLD_PID" ]; then + echo "tomcat is already running, pid=$OLD_PID. Stop it first!" >> control.log + exit 1 + fi + + rm -rf $WEBAPPS/carrera + rm $WEBAPPS/carrera.war + cp carrera.war $WEBAPPS + $TOMCATBIN/startup.sh + echo "tomcat started" >> control.log +} + +function stop() { + if [[ `pgrep -f org.apache.catalina.startup.Bootstrap` ]]; then + pkill -9 -f org.apache.catalina.startup.Bootstrap + fi + t=0 + while [[ `pgrep -f org.apache.catalina.startup.Bootstrap` && "$t" -lt 30 ]]; do + sleep 1 + done + if [[ `pgrep -f org.apache.catalina.startup.Bootstrap` ]]; then + echo "stop tomcat failed" >> control.log + exit 1 + fi + echo "tomcat stopped" >> control.log +} + +case "$1" in + "start") + start + ;; + "stop") + stop + ;; + "reload") + stop + start + ;; + *) + echo "supporting cmd: start/stop/reload" + ;; +esac diff --git a/carrera-prod/n03/consumer/conf/carrera.yaml b/carrera-prod/n03/consumer/conf/carrera.yaml new file mode 100644 index 0000000..c9d53d2 --- /dev/null +++ b/carrera-prod/n03/consumer/conf/carrera.yaml @@ -0,0 +1,3 @@ +zookeeperAddr: 172.18.0.5:2181/carrera/v4/config # config zk cluster address here. +host: 172.18.0.5 # local ip +port: 9713 # thrift server port. diff --git a/carrera-prod/n03/consumer/conf/log4j2.xml b/carrera-prod/n03/consumer/conf/log4j2.xml new file mode 100644 index 0000000..f46b334 --- /dev/null +++ b/carrera-prod/n03/consumer/conf/log4j2.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n03/consumer/control.sh b/carrera-prod/n03/consumer/control.sh new file mode 100755 index 0000000..fd63113 --- /dev/null +++ b/carrera-prod/n03/consumer/control.sh @@ -0,0 +1,107 @@ +#!/bin/bash +MAINCLASS=com.xiaojukeji.carrera.cproxy.proxy.ConsumerProxyMain +CARRERA_VERSION="1.0.0-SNAPSHOT" +CONTROL_LOG="logs/control.log" + +function start() { + OLD_PID="`pgrep -f ${MAINCLASS}`" + if [ "$OLD_PID" ]; then + echo "Proxy is already running, pid=$OLD_PID. Stop it first!" + exit 1 + fi + + BASEDIR=$(dirname "$0") + cd "${BASEDIR}" + PROXY_HOME=`pwd` + mkdir -p logs/old + + CARRERA_CONFIG="${PROXY_HOME}/conf/carrera.yaml" + + # backup log + LOG_NAMES=(carrera.log drop.log error.log main.log metric.log gc.log jstat.log) + LOG_SUFFIX=$(date +%Y%m%d-%H%M%S) + for var in ${LOG_NAMES[@]}; + do + if [ -f "${PROXY_HOME}/logs/${var}" ]; then + mv "${PROXY_HOME}/logs/${var}" "${PROXY_HOME}/logs/old/${var}.${LOG_SUFFIX}" + fi + done + + # set config + LOG_BASE_CONSUMER_LEVEL="INFO" + MEM_OPTS="-Xms512m -Xmx512m" + LOG_SAVE_SIZE="1GB" + LOG_SAVE_TIME="7d" + + export LOG_SAVE_SIZE + export LOG_SAVE_TIME + export LOG_BASE_CONSUMER_LEVEL + + echo "MEM_OPTS: " ${MEM_OPTS} + echo "LOG_SAVE_SIZE="$LOG_SAVE_SIZE", LOG_SAVE_TIME="$LOG_SAVE_TIME", LOG_BASE_CONSUMER_LEVEL="$LOG_BASE_CONSUMER_LEVEL + + JVM_OPTS="${MEM_OPTS} ${JVM_OPTS} " + JVM_OPTS="${JVM_OPTS} -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=50 -XX:+UseCMSInitiatingOccupancyOnly" + JVM_OPTS="${JVM_OPTS} -XX:+PreserveFramePointer -XX:-UseBiasedLocking -XX:-OmitStackTraceInFastThrow" + JVM_OPTS="${JVM_OPTS} -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:${PROXY_HOME}/logs/gc.log" + + JAVA_OPTS="${JAVA_OPTS} -Dlog4j.configurationFile=file://${PROXY_HOME}/conf/log4j2.xml" + JAVA_OPTS="${JAVA_OPTS} -Drocketmq.client.log.loadconfig=false" + JAVA_OPTS="${JAVA_OPTS} -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector" + JAVA_OPTS="${JAVA_OPTS} -Drocketmq.client.maxTimeConsumeContinuously=1000" + + CLASSPATH="${PROXY_HOME}/carrera-consumer-${CARRERA_VERSION}-jar-with-dependencies.jar":$CLASSPATH + + CONSOLE_LOG=${PROXY_HOME}/logs/console.`date +%Y-%m-%d`.log + date >> ${CONSOLE_LOG} + + java ${JVM_OPTS} ${JAVA_OPTS} -cp ${CLASSPATH} ${MAINCLASS} ${CARRERA_CONFIG} >> ${CONSOLE_LOG} 2>&1 & + sleep 2 + date >> ${CONTROL_LOG} + PID="`pgrep -f ${MAINCLASS}`" + if [ "$PID" ]; then + echo "New Proxy is running, pid=$PID" >> ${CONTROL_LOG} + jstat -gcutil -t $PID 30s >> ${PROXY_HOME}/logs/jstat.log 2>&1 & + else + echo "Start Proxy Failed" >> ${CONTROL_LOG} + exit 1 + fi +} + +function stop() { + date >> ${CONTROL_LOG} + PID=$(pgrep -f ${MAINCLASS}) + echo "Killing Proxy =$PID" >> ${CONTROL_LOG} + pkill -f "jstat -gcutil -t $PID 30s" + pkill -f hangAlarm.sh + pkill -15 -f ${MAINCLASS} + t=0 + while [[ `pgrep -f ${MAINCLASS}` && "$t" -lt 120 ]]; do + echo "time=$t,killing `pgrep -f ${MAINCLASS}`" + t=$(($t+1)) + sleep 1 + done + if [ `pgrep -f ${MAINCLASS}` ]; then + echo "stop timeout" + echo "Stop Proxy Failed" >> ${CONTROL_LOG} + exit 1 + fi + echo "KILLED" >> ${CONTROL_LOG} +} + +case "$1" in + "start") + start + ;; + "stop") + stop + ;; + "reload") + stop + start + ;; + *) + echo "supporting cmd: start/stop/reload" + ;; +esac + diff --git a/carrera-prod/n03/producer/conf/carrera.yaml b/carrera-prod/n03/producer/conf/carrera.yaml new file mode 100644 index 0000000..43ead1c --- /dev/null +++ b/carrera-prod/n03/producer/conf/carrera.yaml @@ -0,0 +1,3 @@ +zookeeperAddr: 172.18.0.5:2181/carrera/v4/config # config zk cluster address here. +host: 172.18.0.5 # local ip +port: 9613 # thrift server port. diff --git a/carrera-prod/n03/producer/conf/log4j2.xml b/carrera-prod/n03/producer/conf/log4j2.xml new file mode 100644 index 0000000..fd35d3e --- /dev/null +++ b/carrera-prod/n03/producer/conf/log4j2.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/carrera-prod/n03/producer/control.sh b/carrera-prod/n03/producer/control.sh new file mode 100755 index 0000000..430e628 --- /dev/null +++ b/carrera-prod/n03/producer/control.sh @@ -0,0 +1,106 @@ +#!/bin/bash +MAINCLASS=com.xiaojukeji.carrera.pproxy.proxy.ProducerProxyMain +PROXY_VERSION=1.0.0-SNAPSHOT +CONTROL_LOG="logs/control.log" + +function start() { + OLD_PID="`pgrep -f ${MAINCLASS}`" + if [ "$OLD_PID" ]; then + echo "Proxy is already running, pid=$OLD_PID. Stop it first!" + exit 1 + fi + + BASEDIR=$(dirname "$0") + cd "${BASEDIR}" + PROXY_HOME=`pwd` + mkdir -p logs/old + + CARRERA_CONFIG="${PROXY_HOME}/conf/carrera.yaml" + + # backup log + LOG_NAMES=(carrera.log drop.log error.log metric.log gc.log rocketmq.log) + LOG_SUFFIX=$(date +%Y%m%d-%H%M%S) + for var in ${LOG_NAMES[@]}; + do + if [ -f "${PROXY_HOME}/logs/${var}" ]; then + mv "${PROXY_HOME}/logs/${var}" "${PROXY_HOME}/logs/old/${var}.${LOG_SUFFIX}" + fi + done + + # set config + LOG_CARRERA_LEVEL="INFO" + LOG_BATCH_LEVEL="INFO" + MEM_OPTS="-Xms256m -Xmx256m -Xmn256m" + LOG_SAVE_SIZE="1G" + LOG_SAVE_TIME="7d" + + export LOG_SAVE_SIZE + export LOG_SAVE_TIME + export LOG_CARRERA_LEVEL + export LOG_BATCH_LEVEL + + echo "MEM_OPTS: " ${MEM_OPTS} + echo "LOG_SAVE_SIZE="$LOG_SAVE_SIZE", LOG_SAVE_TIME="$LOG_SAVE_TIME", LOG_CARRERA_LEVEL="$LOG_CARRERA_LEVEL", LOG_BATCH_LEVEL="$LOG_BATCH_LEVEL + + JVM_OPTS="${MEM_OPTS} ${JVM_OPTS} " + JVM_OPTS="${JVM_OPTS} -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=50 -XX:+UseCMSInitiatingOccupancyOnly" + JVM_OPTS="${JVM_OPTS} -XX:+PreserveFramePointer -XX:-UseBiasedLocking -XX:-OmitStackTraceInFastThrow" + JVM_OPTS="${JVM_OPTS} -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:${PROXY_HOME}/logs/gc.log" + JVM_OPTS="${JVM_OPTS} -XX:+PrintSafepointStatistics" + + JAVA_OPTS="${JAVA_OPTS} -Dlog4j.configurationFile=file://${PROXY_HOME}/conf/log4j2.xml" + JAVA_OPTS="${JAVA_OPTS} -Drocketmq.client.log.loadconfig=false" + JAVA_OPTS="${JAVA_OPTS} -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector" + + CLASSPATH="${PROXY_HOME}/carrera-producer-${PROXY_VERSION}-jar-with-dependencies.jar":${CLASSPATH} + + CONSOLE_LOG=${PROXY_HOME}/logs/console.`date +%Y-%m-%d`.log + date >> ${CONSOLE_LOG} + + java ${JVM_OPTS} ${JAVA_OPTS} -cp ${CLASSPATH} ${MAINCLASS} ${CARRERA_CONFIG} >> ${CONSOLE_LOG} 2>&1 & + sleep 2 + date >> ${CONTROL_LOG} + PID="`pgrep -f ${MAINCLASS}`" + if [ "$PID" ]; then + echo "New Proxy is running, pid=$PID" >> ${CONTROL_LOG} + else + echo "Start Proxy Failed" >> ${CONTROL_LOG} + exit 1 + fi +} + +function stop() { + mkdir -p logs + date >> logs/control.log + echo "Killing Proxy =`pgrep -f ${MAINCLASS}`" >> ${CONTROL_LOG} + pkill -15 -f ${MAINCLASS} + t=0 + while [[ `pgrep -f ${MAINCLASS}` && "$t" -lt 60 ]]; do + echo "time=$t,killing `pgrep -f ${MAINCLASS}`" + t=$(($t+1)) + sleep 1 + done + if [ `pgrep -f ${MAINCLASS}` ]; then + echo "Stop Proxy Failed" >> ${CONTROL_LOG} + exit 1 + fi + echo "KILLED" >> ${CONTROL_LOG} +} + + +case "$1" in + "start") + start + ;; + "stop") + stop + ;; + "reload") + stop + start + ;; + *) + echo "supporting cmd: start/stop/reload" + ;; +esac + diff --git a/carrera-prod/n03/start.sh b/carrera-prod/n03/start.sh new file mode 100644 index 0000000..19aca75 --- /dev/null +++ b/carrera-prod/n03/start.sh @@ -0,0 +1,13 @@ + +sh /root/zookeeper/bin/zkServer.sh start +cd /root/console && sh ./control.sh start + +while ! nc -z localhost 8080; do + sleep 0.1 +done + +curl http://localhost:8080/carrera/api/odin/internal/v4/initZkPath +curl http://localhost:8080/carrera/api/odin/internal/v4/initAllZk + +cd /root/consumer && sh ./control.sh start +cd /root/producer && sh ./control.sh start \ No newline at end of file diff --git a/carrera-prod/n03/stop.sh b/carrera-prod/n03/stop.sh new file mode 100644 index 0000000..994c478 --- /dev/null +++ b/carrera-prod/n03/stop.sh @@ -0,0 +1,6 @@ + +sh /root/zookeeper/bin/zkServer.sh stop +cd /root/console && sh ./control.sh stop + +cd /root/consumer && sh ./control.sh stop +cd /root/producer && sh ./control.sh stop \ No newline at end of file diff --git a/carrera-prod/play.sh b/carrera-prod/play.sh new file mode 100755 index 0000000..6e5d48f --- /dev/null +++ b/carrera-prod/play.sh @@ -0,0 +1,35 @@ +# build mysql image +#if [[ "$(docker images -q mysql:1.1 2> /dev/null)" == "" ]]; then +# docker build -t mysql:1.1 ./mysql +#fi + +# build ddmq image +if [[ "$(docker images -q ddmq:n01 2> /dev/null)" == "" ]]; then + docker build -t ddmq:n01 ./n01 +fi + +# build ddmq image +if [[ "$(docker images -q ddmq:n02 2> /dev/null)" == "" ]]; then + docker build -t ddmq:n02 ./n02 +fi + +# build ddmq image +if [[ "$(docker images -q ddmq:n03 2> /dev/null)" == "" ]]; then + docker build -t ddmq:n03 ./n03 +fi + +# run mysql container +#echo 'start mysql container...' +#docker run -td --rm --name mysql --network ddmq-net --ip 172.18.0.2 -p 127.0.0.1:3307:3306 mysql:1.1 + +# run ddmq container +echo 'start ddmq container n01.' +docker run -td --rm --name ddmqn01 --network ddmq-net --ip 172.18.0.3 -p 127.0.0.1:8080:8080 -p 127.0.0.1:9613:9613 -p 127.0.0.1:9713:9713 -v /usr/local/var/rocketmq:/root/rocketmq -v /usr/local/var/log/ddmq/n01:/root/logs --add-host=mysql:192.168.11.247 ddmq:n01 + +# run ddmq container +echo 'start ddmq container n02.' +docker run -td --rm --name ddmqn02 --network ddmq-net --ip 172.18.0.4 -p 127.0.0.1:8081:8080 -p 127.0.0.1:9614:9613 -p 127.0.0.1:9714:9713 -v /usr/local/var/rocketmq:/root/rocketmq -v /usr/local/var/log/ddmq/n02:/root/logs --add-host=mysql:192.168.11.247 ddmq:n02 + +# run ddmq container +echo 'start ddmq container n03.' +docker run -td --rm --name ddmqn03 --network ddmq-net --ip 172.18.0.5 -p 127.0.0.1:8082:8080 -p 127.0.0.1:9615:9613 -p 127.0.0.1:9715:9713 --add-host=mysql:192.168.11.247 ddmq:n03