This is an automated email from the ASF dual-hosted git repository.
hzh0425 pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git
The following commit(s) were added to refs/heads/develop by this push:
new 273f274ec [ISSUE #4781] Add config file for controller run as Namesrv
plugin (#4787)
273f274ec is described below
commit 273f274ec89aa3097c977ffbc38901fdb88950e8
Author: mxsm <[email protected]>
AuthorDate: Fri Aug 5 09:48:33 2022 +0800
[ISSUE #4781] Add config file for controller run as Namesrv plugin (#4787)
LGTM
---
.../bin/controller/fast-try-namesrv-plugin.sh | 76 ++++++++++++++++++++++
.../cluster-3n-namesrv-plugin/namesrv-n0.conf | 25 +++++++
.../cluster-3n-namesrv-plugin/namesrv-n1.conf | 25 +++++++
.../cluster-3n-namesrv-plugin/namesrv-n2.conf | 25 +++++++
4 files changed, 151 insertions(+)
diff --git a/distribution/bin/controller/fast-try-namesrv-plugin.sh
b/distribution/bin/controller/fast-try-namesrv-plugin.sh
new file mode 100644
index 000000000..a349153cc
--- /dev/null
+++ b/distribution/bin/controller/fast-try-namesrv-plugin.sh
@@ -0,0 +1,76 @@
+#!/usr/bin/env bash
+
+# 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.
+
+## Revise the base dir
+CURRENT_DIR="$(cd "$(dirname "$0")"; pwd)"
+RMQ_DIR=$CURRENT_DIR/../..
+cd $RMQ_DIR
+
+startNameserver() {
+ export JAVA_OPT_EXT=" -Xms512m -Xmx512m "
+ conf_name=$1
+ nohup bin/mqnamesrv -c $conf_name &
+}
+
+stopNameserver() {
+ PIDS=$(ps -ef|grep java|grep NamesrvStartup|grep -v grep|awk '{print $2}')
+ if [ ! -z "$PIDS" ]; then
+ kill -s TERM $PIDS
+ fi
+}
+
+stopAll() {
+ stopNameserver
+}
+
+startAll() {
+ startNameserver ./conf/controller/cluster-3n-namesrv-plugin/namesrv-n0.conf
+ startNameserver ./conf/controller/cluster-3n-namesrv-plugin/namesrv-n1.conf
+ startNameserver ./conf/controller/cluster-3n-namesrv-plugin/namesrv-n2.conf
+}
+
+checkConf() {
+ if [ ! -f ./conf/controller/cluster-3n-namesrv-plugin/namesrv-n0.conf -o !
-f ./conf/controller/cluster-3n-namesrv-plugin/namesrv-n1.conf -o ! -f
./conf/controller/cluster-3n-namesrv-plugin/namesrv-n2.conf ]; then
+ echo "Make sure the
./conf/controller/cluster-3n-namesrv-plugin/namesrv-n0.conf,
./conf/controller/cluster-3n-namesrv-plugin/namesrv-n1.conf,
./conf/controller/cluster-3n-namesrv-plugin/namesrv-n2.conf exists"
+ exit 1
+ fi
+}
+
+
+
+## Main
+if [ $# -lt 1 ]; then
+ echo "Usage: sh $0 start|stop"
+ exit 1
+fi
+action=$1
+checkConf
+case $action in
+ "start")
+ startAll
+ exit
+ ;;
+ "stop")
+ stopAll
+ exit
+ ;;
+ *)
+ echo "Usage: sh $0 start|stop"
+ exit
+ ;;
+esac
+
diff --git
a/distribution/conf/controller/cluster-3n-namesrv-plugin/namesrv-n0.conf
b/distribution/conf/controller/cluster-3n-namesrv-plugin/namesrv-n0.conf
new file mode 100644
index 000000000..ee2f5dfc5
--- /dev/null
+++ b/distribution/conf/controller/cluster-3n-namesrv-plugin/namesrv-n0.conf
@@ -0,0 +1,25 @@
+<!--
+ 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.
+ -->
+
+#Namesrv config
+listenPort = 9876
+enableControllerInNamesrv = true
+
+#controller config
+controllerDLegerGroup = group1
+controllerDLegerPeers = n0-127.0.0.1:9878;n1-127.0.0.1:9868;n2-127.0.0.1:9858
+controllerDLegerSelfId = n0
\ No newline at end of file
diff --git
a/distribution/conf/controller/cluster-3n-namesrv-plugin/namesrv-n1.conf
b/distribution/conf/controller/cluster-3n-namesrv-plugin/namesrv-n1.conf
new file mode 100644
index 000000000..9461321a2
--- /dev/null
+++ b/distribution/conf/controller/cluster-3n-namesrv-plugin/namesrv-n1.conf
@@ -0,0 +1,25 @@
+<!--
+ 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.
+ -->
+
+#Namesrv config
+listenPort = 9886
+enableControllerInNamesrv = true
+
+#controller config
+controllerDLegerGroup = group1
+controllerDLegerPeers = n0-127.0.0.1:9878;n1-127.0.0.1:9868;n2-127.0.0.1:9858
+controllerDLegerSelfId = n1
\ No newline at end of file
diff --git
a/distribution/conf/controller/cluster-3n-namesrv-plugin/namesrv-n2.conf
b/distribution/conf/controller/cluster-3n-namesrv-plugin/namesrv-n2.conf
new file mode 100644
index 000000000..aee7e9947
--- /dev/null
+++ b/distribution/conf/controller/cluster-3n-namesrv-plugin/namesrv-n2.conf
@@ -0,0 +1,25 @@
+<!--
+ 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.
+ -->
+
+#Namesrv config
+listenPort = 9896
+enableControllerInNamesrv = true
+
+#controller config
+controllerDLegerGroup = group1
+controllerDLegerPeers = n0-127.0.0.1:9878;n1-127.0.0.1:9868;n2-127.0.0.1:9858
+controllerDLegerSelfId = n2
\ No newline at end of file