Browse Source

[Improvement][registry-plugin] Optimize registry plugin loading and initial installation #5635

zhuangchong 3 years ago
parent
commit
e2d6265e26

+ 0 - 1
.gitignore

@@ -37,7 +37,6 @@ config.gypi
 test/coverage
 /docs/zh_CN/介绍
 /docs/zh_CN/贡献代码.md
-dolphinscheduler-common/src/main/resources/zookeeper.properties
 dolphinscheduler-dao/src/main/resources/dao/data_source.properties
 dolphinscheduler-alert/logs/
 dolphinscheduler-alert/src/main/resources/alert.properties_bak

dolphinscheduler-service/src/main/resources/logback-zookeeper.xml → dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/resources/logback.xml


+ 7 - 7
dolphinscheduler-server/src/main/resources/config/install_config.conf

@@ -34,13 +34,6 @@ password="xx"
 # database name
 dbname="dolphinscheduler"
 
-
-# zk cluster
-zkQuorum="192.168.xx.xx:2181,192.168.xx.xx:2181,192.168.xx.xx:2181"
-
-# zk root directory
-zkRoot="/dolphinscheduler"
-
 # Note: the target installation path for dolphinscheduler, please not config as the same as the current path (pwd)
 installPath="/data1_1T/dolphinscheduler"
 
@@ -53,6 +46,13 @@ deployUser="dolphinscheduler"
 # Note: find and load the Alert Plugin Jar from this dir.
 alertPluginDir="/data1_1T/dolphinscheduler/lib/plugin/alert"
 
+# registry config
+# registry plugin dir
+# Note: find and load the Registry Plugin Jar from this dir.
+registryPluginDir="/data1_1T/dolphinscheduler/lib/plugin/registry"
+registryPluginName="zookeeper"
+registryServers="192.168.xx.xx:2181,192.168.xx.xx:2181,192.168.xx.xx:2181"
+
 # user data local directory path, please make sure the directory exists and have read write permissions
 dataBasedirPath="/tmp/dolphinscheduler"
 

+ 1 - 4
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/registry/RegistryCenter.java

@@ -124,12 +124,9 @@ public class RegistryCenter {
         DolphinPluginManagerConfig registryPluginManagerConfig = new DolphinPluginManagerConfig();
         registryPluginManagerConfig.setPlugins(PropertyUtils.getString(REGISTRY_PLUGIN_BINDING));
         if (StringUtils.isNotBlank(PropertyUtils.getString(REGISTRY_PLUGIN_DIR))) {
-            registryPluginManagerConfig.setPlugins(PropertyUtils.getString(REGISTRY_PLUGIN_DIR, REGISTRY_PLUGIN_PATH).trim());
+            registryPluginManagerConfig.setInstalledPluginsDir(PropertyUtils.getString(REGISTRY_PLUGIN_DIR, REGISTRY_PLUGIN_PATH).trim());
         }
 
-        if (StringUtils.isNotBlank(PropertyUtils.getString(MAVEN_LOCAL_REPOSITORY))) {
-            registryPluginManagerConfig.setMavenLocalRepository(PropertyUtils.getString(MAVEN_LOCAL_REPOSITORY).trim());
-        }
         if (StringUtils.isNotBlank(PropertyUtils.getString(MAVEN_LOCAL_REPOSITORY))) {
             registryPluginManagerConfig.setMavenLocalRepository(PropertyUtils.getString(MAVEN_LOCAL_REPOSITORY).trim());
         }

+ 9 - 9
dolphinscheduler-service/src/main/resources/registry.properties

@@ -15,15 +15,15 @@
 # limitations under the License.
 #
 
-#registry.plugin.dir config the Alert Plugin dir . AlertServer while find and load the Alert Plugin Jar from this dir when deploy and start AlertServer on the server .
-#registry.plugin.dir=/Users/kris/workspace/incubator-dolphinscheduler/dolphinscheduler-dist/target/dolphinscheduler-dist-1.3.6-SNAPSHOT/lib/plugin/registry/zookeeper
-#registry.plugin.name=zookeeper
-#registry.plugin.binding=registry
-#registry.servers=127.0.0.1:2181
-#maven.local.repository=/Users/gaojun/Documents/jianguoyun/localRepository
+#registry.plugin.dir config the Registry Plugin dir.
+registry.plugin.dir=lib/plugin/registry
 
-#registry.plugin.binding config the Alert Plugin need be load when development and run in IDE
-#registry.plugin.binding=\
-#  ./dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/pom.xml
+registry.plugin.name=zookeeper
+registry.servers=127.0.0.1:2181
+
+#maven.local.repository=/usr/local/localRepository
+
+#registry.plugin.binding config the Registry Plugin need be load when development and run in IDE
+#registry.plugin.binding=./dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/pom.xml
 
 

+ 4 - 3
install.sh

@@ -39,9 +39,6 @@ sed -i ${txt} "s@^spring.datasource.url=.*@spring.datasource.url=jdbc:${dbtype}:
 sed -i ${txt} "s@^spring.datasource.username=.*@spring.datasource.username=${username}@g" conf/datasource.properties
 sed -i ${txt} "s@^spring.datasource.password=.*@spring.datasource.password=${password}@g" conf/datasource.properties
 
-sed -i ${txt} "s@^#\?zookeeper.quorum=.*@zookeeper.quorum=${zkQuorum}@g" conf/zookeeper.properties
-sed -i ${txt} "s@^#\?zookeeper.dolphinscheduler.root=.*@zookeeper.dolphinscheduler.root=${zkRoot}@g" conf/zookeeper.properties
-
 sed -i ${txt} "s@^data.basedir.path=.*@data.basedir.path=${dataBasedirPath}@g" conf/common.properties
 sed -i ${txt} "s@^resource.storage.type=.*@resource.storage.type=${resourceStorageType}@g" conf/common.properties
 sed -i ${txt} "s@^resource.upload.path=.*@resource.upload.path=${resourceUploadPath}@g" conf/common.properties
@@ -67,6 +64,10 @@ sed -i ${txt} "s@^#\?alert.listen.host=.*@alert.listen.host=${alertServer}@g" co
 sed -i ${txt} "s@^#\?alert.plugin.dir=.*@alert.plugin.dir=${alertPluginDir}@g" conf/alert.properties
 sed -i ${txt} "s@^#\?server.port=.*@server.port=${apiServerPort}@g" conf/application-api.properties
 
+sed -i ${txt} "s@^#\?registry.plugin.dir=.*@registry.plugin.dir=${registryPluginDir}@g" conf/registry.properties
+sed -i ${txt} "s@^#\?registry.plugin.name=.*@registry.plugin.name=${registryPluginName}@g" conf/registry.properties
+sed -i ${txt} "s@^#\?registry.servers=.*@registry.servers=${registryServers}@g" conf/registry.properties
+
 # 2.create directory
 echo "2.create directory"