From e2d6265e26b27abdf0a212289cca9c0cdad1e0a6 Mon Sep 17 00:00:00 2001 From: zhuangchong <37063904+zhuangchong@users.noreply.github.com> Date: Tue, 15 Jun 2021 20:51:52 +0800 Subject: [PATCH] [Improvement][registry-plugin] Optimize registry plugin loading and initial installation #5635 --- .gitignore | 1 - .../src/main/resources/logback.xml | 0 .../main/resources/config/install_config.conf | 14 +++++++------- .../service/registry/RegistryCenter.java | 5 +---- .../src/main/resources/registry.properties | 18 +++++++++--------- install.sh | 7 ++++--- 6 files changed, 21 insertions(+), 24 deletions(-) rename dolphinscheduler-service/src/main/resources/logback-zookeeper.xml => dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/resources/logback.xml (100%) diff --git a/.gitignore b/.gitignore index 9011db1479..2e1a6478ed 100644 --- a/.gitignore +++ b/.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 diff --git a/dolphinscheduler-service/src/main/resources/logback-zookeeper.xml b/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/resources/logback.xml similarity index 100% rename from dolphinscheduler-service/src/main/resources/logback-zookeeper.xml rename to dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/resources/logback.xml diff --git a/dolphinscheduler-server/src/main/resources/config/install_config.conf b/dolphinscheduler-server/src/main/resources/config/install_config.conf index ab3401c89c..deccd763c1 100755 --- a/dolphinscheduler-server/src/main/resources/config/install_config.conf +++ b/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" diff --git a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/registry/RegistryCenter.java b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/registry/RegistryCenter.java index 31c9777251..143821fe41 100644 --- a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/registry/RegistryCenter.java +++ b/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()); } diff --git a/dolphinscheduler-service/src/main/resources/registry.properties b/dolphinscheduler-service/src/main/resources/registry.properties index 64eaf9bdf5..bf9da2a44d 100644 --- a/dolphinscheduler-service/src/main/resources/registry.properties +++ b/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 diff --git a/install.sh b/install.sh index 3bf494013d..5b0ed74e6c 100755 --- a/install.sh +++ b/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"