From 3e4c221463c62961a80a51111a6a04e050f2af23 Mon Sep 17 00:00:00 2001 From: Tboy Date: Wed, 25 Dec 2019 12:25:40 +0800 Subject: [PATCH 1/4] delete lombok (#1567) * fix #1515 * sleep when resource in not satisfy. fix #1522 * add sleep 1s for no command * fix MasterBaseTaskExecThread submit method bug * updates * add log * delete lombok --- .../common/queue/TaskQueueZkImpl.java | 26 ++----- .../common/zk/ZookeeperConfig.java | 77 +++++++++++++++---- 2 files changed, 69 insertions(+), 34 deletions(-) diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/queue/TaskQueueZkImpl.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/queue/TaskQueueZkImpl.java index 9bc7359174..5eca993120 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/queue/TaskQueueZkImpl.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/queue/TaskQueueZkImpl.java @@ -17,26 +17,16 @@ package org.apache.dolphinscheduler.common.queue; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Comparator; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; - import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.PropertiesConfiguration; +import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.CuratorFrameworkFactory; import org.apache.curator.retry.ExponentialBackoffRetry; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.utils.Bytes; import org.apache.dolphinscheduler.common.utils.IpUtils; import org.apache.dolphinscheduler.common.utils.OSUtils; -import org.apache.dolphinscheduler.common.zk.AbstractZKClient; -import org.apache.curator.framework.CuratorFramework; import org.apache.dolphinscheduler.common.zk.DefaultEnsembleProvider; import org.apache.dolphinscheduler.common.zk.ZookeeperConfig; import org.apache.zookeeper.CreateMode; @@ -44,7 +34,7 @@ import org.apache.zookeeper.data.Stat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static org.apache.dolphinscheduler.common.utils.Preconditions.checkNotNull; +import java.util.*; /** * A singleton of a task queue implemented with zookeeper @@ -421,12 +411,11 @@ public class TaskQueueZkImpl implements ITaskQueue { logger.error("load zookeeper properties file failed, system exit"); System.exit(-1); } - zookeeperConfig = ZookeeperConfig.getFromConf(conf); - zkClient = CuratorFrameworkFactory.builder().ensembleProvider(new DefaultEnsembleProvider(checkNotNull(zookeeperConfig.getServerList(), "zookeeper quorum can't be null"))) - .retryPolicy(new ExponentialBackoffRetry(zookeeperConfig.getBaseSleepTimeMs(), zookeeperConfig.getMaxRetries(), zookeeperConfig.getMaxSleepMs())) - .sessionTimeoutMs(zookeeperConfig.getSessionTimeoutMs()) - .connectionTimeoutMs(zookeeperConfig.getConnectionTimeoutMs()) + zkClient = CuratorFrameworkFactory.builder().ensembleProvider(new DefaultEnsembleProvider(conf.getString("zookeeper.quorum"))) + .retryPolicy(new ExponentialBackoffRetry(conf.getInt("zookeeper.retry.base.sleep"), conf.getInt("zookeeper.retry.maxtime"), conf.getInt("zookeeper.retry.max.sleep"))) + .sessionTimeoutMs(conf.getInt("zookeeper.session.timeout")) + .connectionTimeoutMs(conf.getInt("zookeeper.connection.timeout")) .build(); zkClient.start(); @@ -472,8 +461,7 @@ public class TaskQueueZkImpl implements ITaskQueue { * @return */ public String getTasksPath(String key){ - return zookeeperConfig.getDsRoot() + Constants.SINGLE_SLASH + key; + return "/dolphinscheduler" + Constants.SINGLE_SLASH + key; } - } diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/zk/ZookeeperConfig.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/zk/ZookeeperConfig.java index 6e471bbbfb..a90a147425 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/zk/ZookeeperConfig.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/zk/ZookeeperConfig.java @@ -16,11 +16,6 @@ */ package org.apache.dolphinscheduler.common.zk; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.apache.commons.configuration.Configuration; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; import org.springframework.stereotype.Component; @@ -29,10 +24,6 @@ import org.springframework.stereotype.Component; * zookeeper conf */ @Component -@Data -@AllArgsConstructor -@NoArgsConstructor -@Builder @PropertySource("classpath:zookeeper.properties") public class ZookeeperConfig { @@ -58,14 +49,70 @@ public class ZookeeperConfig { @Value("${zookeeper.connection.digest: }") private String digest; - //ds scheduler install config @Value("${zookeeper.dolphinscheduler.root:/dolphinscheduler}") private String dsRoot; - public static ZookeeperConfig getFromConf(Configuration conf){ - return ZookeeperConfig.builder().serverList(conf.getString("zookeeper.quorum")).baseSleepTimeMs(conf.getInt("zookeeper.retry.base.sleep")) - .maxSleepMs(conf.getInt("zookeeper.retry.max.sleep")).maxRetries(conf.getInt("zookeeper.retry.maxtime")) - .sessionTimeoutMs(conf.getInt("zookeeper.session.timeout")).connectionTimeoutMs(conf.getInt("zookeeper.connection.timeout")) - .dsRoot(conf.getString("zookeeper.dolphinscheduler.root")).build(); + public String getServerList() { + return serverList; + } + + public void setServerList(String serverList) { + this.serverList = serverList; + } + + public int getBaseSleepTimeMs() { + return baseSleepTimeMs; + } + + public void setBaseSleepTimeMs(int baseSleepTimeMs) { + this.baseSleepTimeMs = baseSleepTimeMs; + } + + public int getMaxSleepMs() { + return maxSleepMs; + } + + public void setMaxSleepMs(int maxSleepMs) { + this.maxSleepMs = maxSleepMs; + } + + public int getMaxRetries() { + return maxRetries; + } + + public void setMaxRetries(int maxRetries) { + this.maxRetries = maxRetries; + } + + public int getSessionTimeoutMs() { + return sessionTimeoutMs; + } + + public void setSessionTimeoutMs(int sessionTimeoutMs) { + this.sessionTimeoutMs = sessionTimeoutMs; + } + + public int getConnectionTimeoutMs() { + return connectionTimeoutMs; + } + + public void setConnectionTimeoutMs(int connectionTimeoutMs) { + this.connectionTimeoutMs = connectionTimeoutMs; + } + + public String getDigest() { + return digest; + } + + public void setDigest(String digest) { + this.digest = digest; + } + + public String getDsRoot() { + return dsRoot; + } + + public void setDsRoot(String dsRoot) { + this.dsRoot = dsRoot; } } \ No newline at end of file From 026fdd9e1c2fab944776c6cc09716d0b5b185baa Mon Sep 17 00:00:00 2001 From: break60 <790061044@qq.com> Date: Wed, 25 Dec 2019 12:26:28 +0800 Subject: [PATCH 2/4] License Corrected Version (#1565) * Password verification and v-for add key * DAG automatic layout * combo.js replacement * combo.js replacement * webpack upgrade to 4 * packjson has a file name that has not changed * Solve jertty packing garbled * Modify dashboard color * Remove iconfont, awesome, replace with ans-ui icon * Menu arrow style fix * Script input box style fix * console.log('Front-end third-party js, css introduced using npm * Front-end supplemental license * Modify naming * Repair license * replace cookie.js with js-cookie, add js-cookie license * License Corrected Version * License Corrected Version --- .../licenses/ui-licenses/LICENSE-axios | 2 +- .../licenses/ui-licenses/LICENSE-bootstrap | 3 +- .../licenses/ui-licenses/LICENSE-canvg | 37 +-- .../licenses/ui-licenses/LICENSE-d3 | 39 ++-- .../licenses/ui-licenses/LICENSE-dayjs | 2 +- .../licenses/ui-licenses/LICENSE-echarts | 220 ++++++++++++++++-- .../licenses/ui-licenses/LICENSE-jquery | 57 +++-- .../licenses/ui-licenses/LICENSE-jquery-ui | 4 +- .../licenses/ui-licenses/LICENSE-jsplumb | 2 +- .../licenses/ui-licenses/LICENSE-lodash | 3 - .../licenses/ui-licenses/LICENSE-vue | 2 +- .../licenses/ui-licenses/LICENSE-vue-router | 10 +- .../licenses/ui-licenses/LICENSE-vuex | 2 +- dolphinscheduler-ui/package.json | 2 +- 14 files changed, 292 insertions(+), 93 deletions(-) diff --git a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-axios b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-axios index 2d8d66aa4e..d2c1a12e4c 100644 --- a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-axios +++ b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-axios @@ -1,4 +1,4 @@ -Copyright (c) 2014-present Matt Zabriskie +Copyright (c) 2014 Matt Zabriskie Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-bootstrap b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-bootstrap index 0d367cb7e7..a80e8c2b33 100644 --- a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-bootstrap +++ b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-bootstrap @@ -1,7 +1,6 @@ The MIT License (MIT) -Copyright (c) 2011-2019 Twitter, Inc. -Copyright (c) 2011-2019 The Bootstrap Authors +Copyright (c) 2011-2016 Twitter, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-canvg b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-canvg index 9680fbd497..40f19bd70a 100644 --- a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-canvg +++ b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-canvg @@ -1,21 +1,22 @@ -The MIT License (MIT) +Copyright (c) 2010-2011 Gabe Lerner (gabelerner@gmail.com) - http://code.google.com/p/canvg/ -Copyright (c) 2010 - present Gabe Lerner (gabelerner@gmail.com) - https://github.com/canvg/canvg + 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: -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 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. \ No newline at end of file + 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. \ No newline at end of file diff --git a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-d3 b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-d3 index ab4033721d..a31bde4473 100644 --- a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-d3 +++ b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-d3 @@ -1,19 +1,26 @@ -BSD-3-Clause License +Copyright (c) 2010-2016, Michael Bostock +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: +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. -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. \ No newline at end of file +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* The name Michael Bostock may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-dayjs b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-dayjs index 4a2c701e9b..4c15796322 100644 --- a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-dayjs +++ b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-dayjs @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2018-present, iamkun +Copyright (c) 2018 iamkun Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-echarts b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-echarts index df6036c0b2..989e2c59e9 100644 --- a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-echarts +++ b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-echarts @@ -1,19 +1,201 @@ -Apache-2.0 License - -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. \ No newline at end of file +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 (i) 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. \ No newline at end of file diff --git a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-jquery b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-jquery index fa751429a4..3dd4e447a4 100644 --- a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-jquery +++ b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-jquery @@ -1,21 +1,36 @@ -MIT License - -Copyright (c) 2016-present - -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. \ No newline at end of file +Copyright JS Foundation and other contributors, https://js.foundation/ + +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/jquery/jquery + +The following license applies to all parts of this software except as +documented below: + +==== + +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. + +==== + +All files located in the node_modules and external directories are +externally maintained libraries used by this software which have their +own licenses; we recommend you read them, as their terms may differ from +the terms above. \ No newline at end of file diff --git a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-jquery-ui b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-jquery-ui index 6b42d96d4f..a685832390 100644 --- a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-jquery-ui +++ b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-jquery-ui @@ -1,5 +1,3 @@ -MIT License - Copyright jQuery Foundation and other contributors, https://jquery.org/ This software consists of voluntary contributions made by many @@ -42,4 +40,4 @@ CC0: http://creativecommons.org/publicdomain/zero/1.0/ All files located in the node_modules and external directories are externally maintained libraries used by this software which have their own licenses; we recommend you read them, as their terms may differ from -the terms above. +the terms above. \ No newline at end of file diff --git a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-jsplumb b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-jsplumb index 86358ff42f..f48895213d 100644 --- a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-jsplumb +++ b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-jsplumb @@ -302,4 +302,4 @@ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. +POSSIBILITY OF SUCH DAMAGES. \ No newline at end of file diff --git a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-lodash b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-lodash index 07192178d6..4b5cedae97 100644 --- a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-lodash +++ b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-lodash @@ -1,6 +1,3 @@ - -The MIT License - Copyright JS Foundation and other contributors Based on Underscore.js, copyright Jeremy Ashkenas, diff --git a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-vue b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-vue index e07939948a..51e3f9f426 100644 --- a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-vue +++ b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-vue @@ -1,4 +1,4 @@ -MIT License +The MIT License (MIT) Copyright (c) 2013-present, Yuxi (Evan) You diff --git a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-vue-router b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-vue-router index 767e3e794b..bbfcc77b00 100644 --- a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-vue-router +++ b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-vue-router @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2013-present Evan You +Copyright (c) 2013-2016 Evan You Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -9,13 +9,13 @@ 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 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. \ No newline at end of file +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-vuex b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-vuex index 6a41c241e6..fa6dd9ba37 100644 --- a/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-vuex +++ b/dolphinscheduler-dist/release-docs/licenses/ui-licenses/LICENSE-vuex @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2018-2019 Evan You +Copyright (c) 2015-2016 Evan You Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/dolphinscheduler-ui/package.json b/dolphinscheduler-ui/package.json index 7827e5c1c0..421fd394d6 100644 --- a/dolphinscheduler-ui/package.json +++ b/dolphinscheduler-ui/package.json @@ -29,7 +29,7 @@ "vue": "^2.5.17", "vue-router": "2.7.0", "vuex": "^3.0.0", - "vuex-router-sync": "^4.1.2" + "vuex-router-sync": "^5.0.0" }, "devDependencies": { "autoprefixer": "^9.1.0", From 5f4146eb4e622775242aa1549945d4753708034d Mon Sep 17 00:00:00 2001 From: khadgarmage Date: Thu, 26 Dec 2019 10:23:35 +0800 Subject: [PATCH 3/4] prepare db env for ut mapper test (#1581) * docker compose db * docker compose db * docker compose db * docker compose db * delete init --- .github/workflows/ci_ut.yml | 11 + docker/README.md | 0 docker/docker-compose.yml | 24 + .../docker-entrypoint-initdb/init.sql | 771 ++++++++++++++++++ 4 files changed, 806 insertions(+) create mode 100644 docker/README.md create mode 100644 docker/docker-compose.yml create mode 100755 docker/postgres/docker-entrypoint-initdb/init.sql diff --git a/.github/workflows/ci_ut.yml b/.github/workflows/ci_ut.yml index c893662c1d..ae4d749159 100644 --- a/.github/workflows/ci_ut.yml +++ b/.github/workflows/ci_ut.yml @@ -16,6 +16,9 @@ # on: ["pull_request"] +env: + DOCKER_DIR: ./docker + LOG_DIR: /tmp/dolphinscheduler name: Test Coveralls Parallel @@ -35,6 +38,8 @@ jobs: key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven- + - name: Bootstrap database + run: cd ${DOCKER_DIR} && docker-compose up -d db - name: Set up JDK 1.8 uses: actions/setup-java@v1 with: @@ -44,3 +49,9 @@ jobs: export MAVEN_OPTS='-Dmaven.repo.local=.m2/repository -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit -Xmx3g' mvn test -Dmaven.test.skip=false cobertura:cobertura CODECOV_TOKEN="09c2663f-b091-4258-8a47-c981827eb29a" bash <(curl -s https://codecov.io/bash) + - name: Collect logs + run: | + mkdir -p ${LOG_DIR} + cd ${DOCKER_DIR} + docker-compose logs db > ${LOG_DIR}/db.txt + continue-on-error: true diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000000..de5908583c --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,24 @@ +version: '2' +services: + zookeeper: + image: zookeeper + restart: always + container_name: zookeeper + ports: + - "2181:2181" + environment: + ZOO_MY_ID: 1 + db: + image: postgres + container_name: postgres + environment: + - POSTGRES_USER=test + - POSTGRES_PASSWORD=test + - POSTGRES_DB=dolphinscheduler + ports: + - "5432:5432" + volumes: + - pgdata:/var/lib/postgresql/data + - ./postgres/docker-entrypoint-initdb:/docker-entrypoint-initdb.d +volumes: + pgdata: diff --git a/docker/postgres/docker-entrypoint-initdb/init.sql b/docker/postgres/docker-entrypoint-initdb/init.sql new file mode 100755 index 0000000000..b3c61ebce4 --- /dev/null +++ b/docker/postgres/docker-entrypoint-initdb/init.sql @@ -0,0 +1,771 @@ +/* + * 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. +*/ + +DROP TABLE IF EXISTS QRTZ_FIRED_TRIGGERS; +DROP TABLE IF EXISTS QRTZ_PAUSED_TRIGGER_GRPS; +DROP TABLE IF EXISTS QRTZ_SCHEDULER_STATE; +DROP TABLE IF EXISTS QRTZ_LOCKS; +DROP TABLE IF EXISTS QRTZ_SIMPLE_TRIGGERS; +DROP TABLE IF EXISTS QRTZ_SIMPROP_TRIGGERS; +DROP TABLE IF EXISTS QRTZ_CRON_TRIGGERS; +DROP TABLE IF EXISTS QRTZ_BLOB_TRIGGERS; +DROP TABLE IF EXISTS QRTZ_TRIGGERS; +DROP TABLE IF EXISTS QRTZ_JOB_DETAILS; +DROP TABLE IF EXISTS QRTZ_CALENDARS; + +CREATE TABLE QRTZ_JOB_DETAILS( +SCHED_NAME character varying(120) NOT NULL, +JOB_NAME character varying(200) NOT NULL, +JOB_GROUP character varying(200) NOT NULL, +DESCRIPTION character varying(250) NULL, +JOB_CLASS_NAME character varying(250) NOT NULL, +IS_DURABLE boolean NOT NULL, +IS_NONCONCURRENT boolean NOT NULL, +IS_UPDATE_DATA boolean NOT NULL, +REQUESTS_RECOVERY boolean NOT NULL, +JOB_DATA bytea NULL); +alter table QRTZ_JOB_DETAILS add primary key(SCHED_NAME,JOB_NAME,JOB_GROUP); + +CREATE TABLE QRTZ_TRIGGERS ( +SCHED_NAME character varying(120) NOT NULL, +TRIGGER_NAME character varying(200) NOT NULL, +TRIGGER_GROUP character varying(200) NOT NULL, +JOB_NAME character varying(200) NOT NULL, +JOB_GROUP character varying(200) NOT NULL, +DESCRIPTION character varying(250) NULL, +NEXT_FIRE_TIME BIGINT NULL, +PREV_FIRE_TIME BIGINT NULL, +PRIORITY INTEGER NULL, +TRIGGER_STATE character varying(16) NOT NULL, +TRIGGER_TYPE character varying(8) NOT NULL, +START_TIME BIGINT NOT NULL, +END_TIME BIGINT NULL, +CALENDAR_NAME character varying(200) NULL, +MISFIRE_INSTR SMALLINT NULL, +JOB_DATA bytea NULL) ; +alter table QRTZ_TRIGGERS add primary key(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); + +CREATE TABLE QRTZ_SIMPLE_TRIGGERS ( +SCHED_NAME character varying(120) NOT NULL, +TRIGGER_NAME character varying(200) NOT NULL, +TRIGGER_GROUP character varying(200) NOT NULL, +REPEAT_COUNT BIGINT NOT NULL, +REPEAT_INTERVAL BIGINT NOT NULL, +TIMES_TRIGGERED BIGINT NOT NULL) ; +alter table QRTZ_SIMPLE_TRIGGERS add primary key(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); + +CREATE TABLE QRTZ_CRON_TRIGGERS ( +SCHED_NAME character varying(120) NOT NULL, +TRIGGER_NAME character varying(200) NOT NULL, +TRIGGER_GROUP character varying(200) NOT NULL, +CRON_EXPRESSION character varying(120) NOT NULL, +TIME_ZONE_ID character varying(80)) ; +alter table QRTZ_CRON_TRIGGERS add primary key(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); + +CREATE TABLE QRTZ_SIMPROP_TRIGGERS + ( + SCHED_NAME character varying(120) NOT NULL, + TRIGGER_NAME character varying(200) NOT NULL, + TRIGGER_GROUP character varying(200) NOT NULL, + STR_PROP_1 character varying(512) NULL, + STR_PROP_2 character varying(512) NULL, + STR_PROP_3 character varying(512) NULL, + INT_PROP_1 INT NULL, + INT_PROP_2 INT NULL, + LONG_PROP_1 BIGINT NULL, + LONG_PROP_2 BIGINT NULL, + DEC_PROP_1 NUMERIC(13,4) NULL, + DEC_PROP_2 NUMERIC(13,4) NULL, + BOOL_PROP_1 boolean NULL, + BOOL_PROP_2 boolean NULL) ; +alter table QRTZ_SIMPROP_TRIGGERS add primary key(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); + +CREATE TABLE QRTZ_BLOB_TRIGGERS ( +SCHED_NAME character varying(120) NOT NULL, +TRIGGER_NAME character varying(200) NOT NULL, +TRIGGER_GROUP character varying(200) NOT NULL, +BLOB_DATA bytea NULL) ; +alter table QRTZ_BLOB_TRIGGERS add primary key(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); + +CREATE TABLE QRTZ_CALENDARS ( +SCHED_NAME character varying(120) NOT NULL, +CALENDAR_NAME character varying(200) NOT NULL, +CALENDAR bytea NOT NULL) ; +alter table QRTZ_CALENDARS add primary key(SCHED_NAME,CALENDAR_NAME); + +CREATE TABLE QRTZ_PAUSED_TRIGGER_GRPS ( +SCHED_NAME character varying(120) NOT NULL, +TRIGGER_GROUP character varying(200) NOT NULL) ; +alter table QRTZ_PAUSED_TRIGGER_GRPS add primary key(SCHED_NAME,TRIGGER_GROUP); + +CREATE TABLE QRTZ_FIRED_TRIGGERS ( +SCHED_NAME character varying(120) NOT NULL, +ENTRY_ID character varying(95) NOT NULL, +TRIGGER_NAME character varying(200) NOT NULL, +TRIGGER_GROUP character varying(200) NOT NULL, +INSTANCE_NAME character varying(200) NOT NULL, +FIRED_TIME BIGINT NOT NULL, +SCHED_TIME BIGINT NOT NULL, +PRIORITY INTEGER NOT NULL, +STATE character varying(16) NOT NULL, +JOB_NAME character varying(200) NULL, +JOB_GROUP character varying(200) NULL, +IS_NONCONCURRENT boolean NULL, +REQUESTS_RECOVERY boolean NULL) ; +alter table QRTZ_FIRED_TRIGGERS add primary key(SCHED_NAME,ENTRY_ID); + +CREATE TABLE QRTZ_SCHEDULER_STATE ( +SCHED_NAME character varying(120) NOT NULL, +INSTANCE_NAME character varying(200) NOT NULL, +LAST_CHECKIN_TIME BIGINT NOT NULL, +CHECKIN_INTERVAL BIGINT NOT NULL) ; +alter table QRTZ_SCHEDULER_STATE add primary key(SCHED_NAME,INSTANCE_NAME); + +CREATE TABLE QRTZ_LOCKS ( +SCHED_NAME character varying(120) NOT NULL, +LOCK_NAME character varying(40) NOT NULL) ; +alter table QRTZ_LOCKS add primary key(SCHED_NAME,LOCK_NAME); + +CREATE INDEX IDX_QRTZ_J_REQ_RECOVERY ON QRTZ_JOB_DETAILS(SCHED_NAME,REQUESTS_RECOVERY); +CREATE INDEX IDX_QRTZ_J_GRP ON QRTZ_JOB_DETAILS(SCHED_NAME,JOB_GROUP); + +CREATE INDEX IDX_QRTZ_T_J ON QRTZ_TRIGGERS(SCHED_NAME,JOB_NAME,JOB_GROUP); +CREATE INDEX IDX_QRTZ_T_JG ON QRTZ_TRIGGERS(SCHED_NAME,JOB_GROUP); +CREATE INDEX IDX_QRTZ_T_C ON QRTZ_TRIGGERS(SCHED_NAME,CALENDAR_NAME); +CREATE INDEX IDX_QRTZ_T_G ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_GROUP); +CREATE INDEX IDX_QRTZ_T_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_STATE); +CREATE INDEX IDX_QRTZ_T_N_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_STATE); +CREATE INDEX IDX_QRTZ_T_N_G_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_GROUP,TRIGGER_STATE); +CREATE INDEX IDX_QRTZ_T_NEXT_FIRE_TIME ON QRTZ_TRIGGERS(SCHED_NAME,NEXT_FIRE_TIME); +CREATE INDEX IDX_QRTZ_T_NFT_ST ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_STATE,NEXT_FIRE_TIME); +CREATE INDEX IDX_QRTZ_T_NFT_MISFIRE ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME); +CREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_STATE); +CREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE_GRP ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_GROUP,TRIGGER_STATE); + +CREATE INDEX IDX_QRTZ_FT_TRIG_INST_NAME ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,INSTANCE_NAME); +CREATE INDEX IDX_QRTZ_FT_INST_JOB_REQ_RCVRY ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,INSTANCE_NAME,REQUESTS_RECOVERY); +CREATE INDEX IDX_QRTZ_FT_J_G ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,JOB_NAME,JOB_GROUP); +CREATE INDEX IDX_QRTZ_FT_JG ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,JOB_GROUP); +CREATE INDEX IDX_QRTZ_FT_T_G ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); +CREATE INDEX IDX_QRTZ_FT_TG ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_GROUP); + + +-- +-- Table structure for table t_ds_access_token +-- + +DROP TABLE IF EXISTS t_ds_access_token; +CREATE TABLE t_ds_access_token ( + id int NOT NULL , + user_id int DEFAULT NULL , + token varchar(64) DEFAULT NULL , + expire_time timestamp DEFAULT NULL , + create_time timestamp DEFAULT NULL , + update_time timestamp DEFAULT NULL , + PRIMARY KEY (id) +) ; + +-- +-- Table structure for table t_ds_alert +-- + +DROP TABLE IF EXISTS t_ds_alert; +CREATE TABLE t_ds_alert ( + id int NOT NULL , + title varchar(64) DEFAULT NULL , + show_type int DEFAULT NULL , + content text , + alert_type int DEFAULT NULL , + alert_status int DEFAULT '0' , + log text , + alertgroup_id int DEFAULT NULL , + receivers text , + receivers_cc text , + create_time timestamp DEFAULT NULL , + update_time timestamp DEFAULT NULL , + PRIMARY KEY (id) +) ; +-- +-- Table structure for table t_ds_alertgroup +-- + +DROP TABLE IF EXISTS t_ds_alertgroup; +CREATE TABLE t_ds_alertgroup ( + id int NOT NULL , + group_name varchar(255) DEFAULT NULL , + group_type int DEFAULT NULL , + description varchar(255) DEFAULT NULL , + create_time timestamp DEFAULT NULL , + update_time timestamp DEFAULT NULL , + PRIMARY KEY (id) +) ; + +-- +-- Table structure for table t_ds_command +-- + +DROP TABLE IF EXISTS t_ds_command; +CREATE TABLE t_ds_command ( + id int NOT NULL , + command_type int DEFAULT NULL , + process_definition_id int DEFAULT NULL , + command_param text , + task_depend_type int DEFAULT NULL , + failure_strategy int DEFAULT '0' , + warning_type int DEFAULT '0' , + warning_group_id int DEFAULT NULL , + schedule_time timestamp DEFAULT NULL , + start_time timestamp DEFAULT NULL , + executor_id int DEFAULT NULL , + dependence varchar(255) DEFAULT NULL , + update_time timestamp DEFAULT NULL , + process_instance_priority int DEFAULT NULL , + worker_group_id int DEFAULT '-1' , + PRIMARY KEY (id) +) ; + +-- +-- Table structure for table t_ds_datasource +-- + +DROP TABLE IF EXISTS t_ds_datasource; +CREATE TABLE t_ds_datasource ( + id int NOT NULL , + name varchar(64) NOT NULL , + note varchar(256) DEFAULT NULL , + type int NOT NULL , + user_id int NOT NULL , + connection_params text NOT NULL , + create_time timestamp NOT NULL , + update_time timestamp DEFAULT NULL , + PRIMARY KEY (id) +) ; + +-- +-- Table structure for table t_ds_error_command +-- + +DROP TABLE IF EXISTS t_ds_error_command; +CREATE TABLE t_ds_error_command ( + id int NOT NULL , + command_type int DEFAULT NULL , + executor_id int DEFAULT NULL , + process_definition_id int DEFAULT NULL , + command_param text , + task_depend_type int DEFAULT NULL , + failure_strategy int DEFAULT '0' , + warning_type int DEFAULT '0' , + warning_group_id int DEFAULT NULL , + schedule_time timestamp DEFAULT NULL , + start_time timestamp DEFAULT NULL , + update_time timestamp DEFAULT NULL , + dependence text , + process_instance_priority int DEFAULT NULL , + worker_group_id int DEFAULT '-1' , + message text , + PRIMARY KEY (id) +); +-- +-- Table structure for table t_ds_master_server +-- + +DROP TABLE IF EXISTS t_ds_master_server; +CREATE TABLE t_ds_master_server ( + id int NOT NULL , + host varchar(45) DEFAULT NULL , + port int DEFAULT NULL , + zk_directory varchar(64) DEFAULT NULL , + res_info varchar(256) DEFAULT NULL , + create_time timestamp DEFAULT NULL , + last_heartbeat_time timestamp DEFAULT NULL , + PRIMARY KEY (id) +) ; + +-- +-- Table structure for table t_ds_process_definition +-- + +DROP TABLE IF EXISTS t_ds_process_definition; +CREATE TABLE t_ds_process_definition ( + id int NOT NULL , + name varchar(255) DEFAULT NULL , + version int DEFAULT NULL , + release_state int DEFAULT NULL , + project_id int DEFAULT NULL , + user_id int DEFAULT NULL , + process_definition_json text , + description text , + global_params text , + flag int DEFAULT NULL , + locations text , + connects text , + receivers text , + receivers_cc text , + create_time timestamp DEFAULT NULL , + timeout int DEFAULT '0' , + tenant_id int NOT NULL DEFAULT '-1' , + update_time timestamp DEFAULT NULL , + PRIMARY KEY (id) +) ; + +create index process_definition_index on t_ds_process_definition (project_id,id); + +-- +-- Table structure for table t_ds_process_instance +-- + +DROP TABLE IF EXISTS t_ds_process_instance; +CREATE TABLE t_ds_process_instance ( + id int NOT NULL , + name varchar(255) DEFAULT NULL , + process_definition_id int DEFAULT NULL , + state int DEFAULT NULL , + recovery int DEFAULT NULL , + start_time timestamp DEFAULT NULL , + end_time timestamp DEFAULT NULL , + run_times int DEFAULT NULL , + host varchar(45) DEFAULT NULL , + command_type int DEFAULT NULL , + command_param text , + task_depend_type int DEFAULT NULL , + max_try_times int DEFAULT '0' , + failure_strategy int DEFAULT '0' , + warning_type int DEFAULT '0' , + warning_group_id int DEFAULT NULL , + schedule_time timestamp DEFAULT NULL , + command_start_time timestamp DEFAULT NULL , + global_params text , + process_instance_json text , + flag int DEFAULT '1' , + update_time timestamp NULL , + is_sub_process int DEFAULT '0' , + executor_id int NOT NULL , + locations text , + connects text , + history_cmd text , + dependence_schedule_times text , + process_instance_priority int DEFAULT NULL , + worker_group_id int DEFAULT '-1' , + timeout int DEFAULT '0' , + tenant_id int NOT NULL DEFAULT '-1' , + PRIMARY KEY (id) +) ; + create index process_instance_index on t_ds_process_instance (process_definition_id,id); + create index start_time_index on t_ds_process_instance (start_time); + +-- +-- Table structure for table t_ds_project +-- + +DROP TABLE IF EXISTS t_ds_project; +CREATE TABLE t_ds_project ( + id int NOT NULL , + name varchar(100) DEFAULT NULL , + description varchar(200) DEFAULT NULL , + user_id int DEFAULT NULL , + flag int DEFAULT '1' , + create_time timestamp DEFAULT CURRENT_TIMESTAMP , + update_time timestamp DEFAULT CURRENT_TIMESTAMP , + PRIMARY KEY (id) +) ; + create index user_id_index on t_ds_project (user_id); + +-- +-- Table structure for table t_ds_queue +-- + +DROP TABLE IF EXISTS t_ds_queue; +CREATE TABLE t_ds_queue ( + id int NOT NULL , + queue_name varchar(64) DEFAULT NULL , + queue varchar(64) DEFAULT NULL , + create_time timestamp DEFAULT NULL , + update_time timestamp DEFAULT NULL , + PRIMARY KEY (id) +); + + +-- +-- Table structure for table t_ds_relation_datasource_user +-- + +DROP TABLE IF EXISTS t_ds_relation_datasource_user; +CREATE TABLE t_ds_relation_datasource_user ( + id int NOT NULL , + user_id int NOT NULL , + datasource_id int DEFAULT NULL , + perm int DEFAULT '1' , + create_time timestamp DEFAULT NULL , + update_time timestamp DEFAULT NULL , + PRIMARY KEY (id) +) ; +; + +-- +-- Table structure for table t_ds_relation_process_instance +-- + +DROP TABLE IF EXISTS t_ds_relation_process_instance; +CREATE TABLE t_ds_relation_process_instance ( + id int NOT NULL , + parent_process_instance_id int DEFAULT NULL , + parent_task_instance_id int DEFAULT NULL , + process_instance_id int DEFAULT NULL , + PRIMARY KEY (id) +) ; + + +-- +-- Table structure for table t_ds_relation_project_user +-- + +DROP TABLE IF EXISTS t_ds_relation_project_user; +CREATE TABLE t_ds_relation_project_user ( + id int NOT NULL , + user_id int NOT NULL , + project_id int DEFAULT NULL , + perm int DEFAULT '1' , + create_time timestamp DEFAULT NULL , + update_time timestamp DEFAULT NULL , + PRIMARY KEY (id) +) ; +create index relation_project_user_id_index on t_ds_relation_project_user (user_id); + +-- +-- Table structure for table t_ds_relation_resources_user +-- + +DROP TABLE IF EXISTS t_ds_relation_resources_user; +CREATE TABLE t_ds_relation_resources_user ( + id int NOT NULL , + user_id int NOT NULL , + resources_id int DEFAULT NULL , + perm int DEFAULT '1' , + create_time timestamp DEFAULT NULL , + update_time timestamp DEFAULT NULL , + PRIMARY KEY (id) +) ; + +-- +-- Table structure for table t_ds_relation_udfs_user +-- + +DROP TABLE IF EXISTS t_ds_relation_udfs_user; +CREATE TABLE t_ds_relation_udfs_user ( + id int NOT NULL , + user_id int NOT NULL , + udf_id int DEFAULT NULL , + perm int DEFAULT '1' , + create_time timestamp DEFAULT NULL , + update_time timestamp DEFAULT NULL , + PRIMARY KEY (id) +) ; +; + +-- +-- Table structure for table t_ds_relation_user_alertgroup +-- + +DROP TABLE IF EXISTS t_ds_relation_user_alertgroup; +CREATE TABLE t_ds_relation_user_alertgroup ( + id int NOT NULL, + alertgroup_id int DEFAULT NULL, + user_id int DEFAULT NULL, + create_time timestamp DEFAULT NULL, + update_time timestamp DEFAULT NULL, + PRIMARY KEY (id) +); + +-- +-- Table structure for table t_ds_resources +-- + +DROP TABLE IF EXISTS t_ds_resources; +CREATE TABLE t_ds_resources ( + id int NOT NULL , + alias varchar(64) DEFAULT NULL , + file_name varchar(64) DEFAULT NULL , + description varchar(256) DEFAULT NULL , + user_id int DEFAULT NULL , + type int DEFAULT NULL , + size bigint DEFAULT NULL , + create_time timestamp DEFAULT NULL , + update_time timestamp DEFAULT NULL , + PRIMARY KEY (id) +) ; +; + +-- +-- Table structure for table t_ds_schedules +-- + +DROP TABLE IF EXISTS t_ds_schedules; +CREATE TABLE t_ds_schedules ( + id int NOT NULL , + process_definition_id int NOT NULL , + start_time timestamp NOT NULL , + end_time timestamp NOT NULL , + crontab varchar(256) NOT NULL , + failure_strategy int NOT NULL , + user_id int NOT NULL , + release_state int NOT NULL , + warning_type int NOT NULL , + warning_group_id int DEFAULT NULL , + process_instance_priority int DEFAULT NULL , + worker_group_id int DEFAULT '-1' , + create_time timestamp NOT NULL , + update_time timestamp NOT NULL , + PRIMARY KEY (id) +); + +-- +-- Table structure for table t_ds_session +-- + +DROP TABLE IF EXISTS t_ds_session; +CREATE TABLE t_ds_session ( + id varchar(64) NOT NULL , + user_id int DEFAULT NULL , + ip varchar(45) DEFAULT NULL , + last_login_time timestamp DEFAULT NULL , + PRIMARY KEY (id) +); + +-- +-- Table structure for table t_ds_task_instance +-- + +DROP TABLE IF EXISTS t_ds_task_instance; +CREATE TABLE t_ds_task_instance ( + id int NOT NULL , + name varchar(255) DEFAULT NULL , + task_type varchar(64) DEFAULT NULL , + process_definition_id int DEFAULT NULL , + process_instance_id int DEFAULT NULL , + task_json text , + state int DEFAULT NULL , + submit_time timestamp DEFAULT NULL , + start_time timestamp DEFAULT NULL , + end_time timestamp DEFAULT NULL , + host varchar(45) DEFAULT NULL , + execute_path varchar(200) DEFAULT NULL , + log_path varchar(200) DEFAULT NULL , + alert_flag int DEFAULT NULL , + retry_times int DEFAULT '0' , + pid int DEFAULT NULL , + app_link varchar(255) DEFAULT NULL , + flag int DEFAULT '1' , + retry_interval int DEFAULT NULL , + max_retry_times int DEFAULT NULL , + task_instance_priority int DEFAULT NULL , + worker_group_id int DEFAULT '-1' , + PRIMARY KEY (id) +) ; + +-- +-- Table structure for table t_ds_tenant +-- + +DROP TABLE IF EXISTS t_ds_tenant; +CREATE TABLE t_ds_tenant ( + id int NOT NULL , + tenant_code varchar(64) DEFAULT NULL , + tenant_name varchar(64) DEFAULT NULL , + description varchar(256) DEFAULT NULL , + queue_id int DEFAULT NULL , + create_time timestamp DEFAULT NULL , + update_time timestamp DEFAULT NULL , + PRIMARY KEY (id) +) ; + +-- +-- Table structure for table t_ds_udfs +-- + +DROP TABLE IF EXISTS t_ds_udfs; +CREATE TABLE t_ds_udfs ( + id int NOT NULL , + user_id int NOT NULL , + func_name varchar(100) NOT NULL , + class_name varchar(255) NOT NULL , + type int NOT NULL , + arg_types varchar(255) DEFAULT NULL , + database varchar(255) DEFAULT NULL , + description varchar(255) DEFAULT NULL , + resource_id int NOT NULL , + resource_name varchar(255) NOT NULL , + create_time timestamp NOT NULL , + update_time timestamp NOT NULL , + PRIMARY KEY (id) +) ; + +-- +-- Table structure for table t_ds_user +-- + +DROP TABLE IF EXISTS t_ds_user; +CREATE TABLE t_ds_user ( + id int NOT NULL , + user_name varchar(64) DEFAULT NULL , + user_password varchar(64) DEFAULT NULL , + user_type int DEFAULT NULL , + email varchar(64) DEFAULT NULL , + phone varchar(11) DEFAULT NULL , + tenant_id int DEFAULT NULL , + create_time timestamp DEFAULT NULL , + update_time timestamp DEFAULT NULL , + queue varchar(64) DEFAULT NULL , + PRIMARY KEY (id) +); + +-- +-- Table structure for table t_ds_version +-- + +DROP TABLE IF EXISTS t_ds_version; +CREATE TABLE t_ds_version ( + id int NOT NULL , + version varchar(200) NOT NULL, + PRIMARY KEY (id) +) ; +create index version_index on t_ds_version(version); + +-- +-- Table structure for table t_ds_worker_group +-- + +DROP TABLE IF EXISTS t_ds_worker_group; +CREATE TABLE t_ds_worker_group ( + id bigint NOT NULL , + name varchar(256) DEFAULT NULL , + ip_list varchar(256) DEFAULT NULL , + create_time timestamp DEFAULT NULL , + update_time timestamp DEFAULT NULL , + PRIMARY KEY (id) +) ; + +-- +-- Table structure for table t_ds_worker_server +-- + +DROP TABLE IF EXISTS t_ds_worker_server; +CREATE TABLE t_ds_worker_server ( + id int NOT NULL , + host varchar(45) DEFAULT NULL , + port int DEFAULT NULL , + zk_directory varchar(64) DEFAULT NULL , + res_info varchar(255) DEFAULT NULL , + create_time timestamp DEFAULT NULL , + last_heartbeat_time timestamp DEFAULT NULL , + PRIMARY KEY (id) +) ; + + +DROP SEQUENCE IF EXISTS t_ds_access_token_id_sequence; +CREATE SEQUENCE t_ds_access_token_id_sequence; +ALTER TABLE t_ds_access_token ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_access_token_id_sequence'); +DROP SEQUENCE IF EXISTS t_ds_alert_id_sequence; +CREATE SEQUENCE t_ds_alert_id_sequence; +ALTER TABLE t_ds_alert ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_alert_id_sequence'); +DROP SEQUENCE IF EXISTS t_ds_alertgroup_id_sequence; +CREATE SEQUENCE t_ds_alertgroup_id_sequence; +ALTER TABLE t_ds_alertgroup ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_alertgroup_id_sequence'); + +DROP SEQUENCE IF EXISTS t_ds_command_id_sequence; +CREATE SEQUENCE t_ds_command_id_sequence; +ALTER TABLE t_ds_command ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_command_id_sequence'); +DROP SEQUENCE IF EXISTS t_ds_datasource_id_sequence; +CREATE SEQUENCE t_ds_datasource_id_sequence; +ALTER TABLE t_ds_datasource ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_datasource_id_sequence'); +DROP SEQUENCE IF EXISTS t_ds_master_server_id_sequence; +CREATE SEQUENCE t_ds_master_server_id_sequence; +ALTER TABLE t_ds_master_server ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_master_server_id_sequence'); +DROP SEQUENCE IF EXISTS t_ds_process_definition_id_sequence; +CREATE SEQUENCE t_ds_process_definition_id_sequence; +ALTER TABLE t_ds_process_definition ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_process_definition_id_sequence'); +DROP SEQUENCE IF EXISTS t_ds_process_instance_id_sequence; +CREATE SEQUENCE t_ds_process_instance_id_sequence; +ALTER TABLE t_ds_process_instance ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_process_instance_id_sequence'); +DROP SEQUENCE IF EXISTS t_ds_project_id_sequence; +CREATE SEQUENCE t_ds_project_id_sequence; +ALTER TABLE t_ds_project ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_project_id_sequence'); +DROP SEQUENCE IF EXISTS t_ds_queue_id_sequence; +CREATE SEQUENCE t_ds_queue_id_sequence; +ALTER TABLE t_ds_queue ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_queue_id_sequence'); + +DROP SEQUENCE IF EXISTS t_ds_relation_datasource_user_id_sequence; +CREATE SEQUENCE t_ds_relation_datasource_user_id_sequence; +ALTER TABLE t_ds_relation_datasource_user ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_datasource_user_id_sequence'); +DROP SEQUENCE IF EXISTS t_ds_relation_process_instance_id_sequence; +CREATE SEQUENCE t_ds_relation_process_instance_id_sequence; +ALTER TABLE t_ds_relation_process_instance ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_process_instance_id_sequence'); +DROP SEQUENCE IF EXISTS t_ds_relation_project_user_id_sequence; +CREATE SEQUENCE t_ds_relation_project_user_id_sequence; +ALTER TABLE t_ds_relation_project_user ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_project_user_id_sequence'); +DROP SEQUENCE IF EXISTS t_ds_relation_resources_user_id_sequence; +CREATE SEQUENCE t_ds_relation_resources_user_id_sequence; +ALTER TABLE t_ds_relation_resources_user ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_resources_user_id_sequence'); +DROP SEQUENCE IF EXISTS t_ds_relation_udfs_user_id_sequence; +CREATE SEQUENCE t_ds_relation_udfs_user_id_sequence; +ALTER TABLE t_ds_relation_udfs_user ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_udfs_user_id_sequence'); +DROP SEQUENCE IF EXISTS t_ds_relation_user_alertgroup_id_sequence; +CREATE SEQUENCE t_ds_relation_user_alertgroup_id_sequence; +ALTER TABLE t_ds_relation_user_alertgroup ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_user_alertgroup_id_sequence'); + +DROP SEQUENCE IF EXISTS t_ds_resources_id_sequence; +CREATE SEQUENCE t_ds_resources_id_sequence; +ALTER TABLE t_ds_resources ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_resources_id_sequence'); +DROP SEQUENCE IF EXISTS t_ds_schedules_id_sequence; +CREATE SEQUENCE t_ds_schedules_id_sequence; +ALTER TABLE t_ds_schedules ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_schedules_id_sequence'); +DROP SEQUENCE IF EXISTS t_ds_task_instance_id_sequence; +CREATE SEQUENCE t_ds_task_instance_id_sequence; +ALTER TABLE t_ds_task_instance ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_task_instance_id_sequence'); +DROP SEQUENCE IF EXISTS t_ds_tenant_id_sequence; +CREATE SEQUENCE t_ds_tenant_id_sequence; +ALTER TABLE t_ds_tenant ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_tenant_id_sequence'); +DROP SEQUENCE IF EXISTS t_ds_udfs_id_sequence; +CREATE SEQUENCE t_ds_udfs_id_sequence; +ALTER TABLE t_ds_udfs ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_udfs_id_sequence'); +DROP SEQUENCE IF EXISTS t_ds_user_id_sequence; +CREATE SEQUENCE t_ds_user_id_sequence; +ALTER TABLE t_ds_user ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_user_id_sequence'); + +DROP SEQUENCE IF EXISTS t_ds_version_id_sequence; +CREATE SEQUENCE t_ds_version_id_sequence; +ALTER TABLE t_ds_version ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_version_id_sequence'); + +DROP SEQUENCE IF EXISTS t_ds_worker_group_id_sequence; +CREATE SEQUENCE t_ds_worker_group_id_sequence; +ALTER TABLE t_ds_worker_group ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_worker_group_id_sequence'); +DROP SEQUENCE IF EXISTS t_ds_worker_server_id_sequence; +CREATE SEQUENCE t_ds_worker_server_id_sequence; +ALTER TABLE t_ds_worker_server ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_worker_server_id_sequence'); + + +-- Records of t_ds_user,user : admin , password : dolphinscheduler123 +INSERT INTO t_ds_user(user_name,user_password,user_type,email,phone,tenant_id,create_time,update_time) VALUES ('admin', '7ad2410b2f4c074479a8937a28a22b8f', '0', 'xxx@qq.com', 'xx', '0', '2018-03-27 15:48:50', '2018-10-24 17:40:22'); + +-- Records of t_ds_alertgroup,dolphinscheduler warning group +INSERT INTO t_ds_alertgroup(group_name,group_type,description,create_time,update_time) VALUES ('dolphinscheduler warning group', '0', 'dolphinscheduler warning group','2018-11-29 10:20:39', '2018-11-29 10:20:39'); +INSERT INTO t_ds_relation_user_alertgroup(alertgroup_id,user_id,create_time,update_time) VALUES ( '1', '1', '2018-11-29 10:22:33', '2018-11-29 10:22:33'); + +-- Records of t_ds_queue,default queue name : default +INSERT INTO t_ds_queue(queue_name,queue,create_time,update_time) VALUES ('default', 'default','2018-11-29 10:22:33', '2018-11-29 10:22:33'); + +-- Records of t_ds_queue,default queue name : default +INSERT INTO t_ds_version(version) VALUES ('1.2.0'); \ No newline at end of file From 18e8703b70f669242af0b01c13ea3642676f127a Mon Sep 17 00:00:00 2001 From: qiaozhanwei Date: Thu, 26 Dec 2019 11:41:58 +0800 Subject: [PATCH 4/4] remove kazoo (#1575) * remove LogViewServiceGrpc.java file and pom modify * remove kazoo * remove kazoo * remove kazoo * remove common monitor package * add license * remove kazoo modify * remove kazoo modify * remove kazoo modify * remove kazoo modify * remove kazoo modify * remove kazoo modify * install.sh remove python kazoo * add system param whether repeat running * remove kazoo modify * BusinessTimeUtils remove whther repeat running inner param --- .../dolphinscheduler/common/Constants.java | 2 + .../server/monitor/AbstractMonitor.java | 126 ++++++++++++++++++ .../server/monitor/Monitor.java | 28 ++++ .../server/monitor/MonitorServer.java | 63 +++++++++ .../server/monitor/RunConfig.java | 85 ++++++++++++ .../server/monitor/ZKMonitorImpl.java | 62 +++++++++ .../server/utils/RemoveZKNode.java | 59 ++++++++ .../resources}/config/install_config.conf | 0 .../main/resources}/config/run_config.conf | 0 install.sh | 31 +---- script/del-zk-node.py | 34 ----- script/monitor-server.py | 124 ----------------- script/monitor-server.sh | 52 ++++++++ script/remove-zk-node.sh | 48 +++++++ 14 files changed, 528 insertions(+), 186 deletions(-) create mode 100644 dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/monitor/AbstractMonitor.java create mode 100644 dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/monitor/Monitor.java create mode 100644 dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/monitor/MonitorServer.java create mode 100644 dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/monitor/RunConfig.java create mode 100644 dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/monitor/ZKMonitorImpl.java create mode 100644 dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/RemoveZKNode.java rename {script => dolphinscheduler-server/src/main/resources}/config/install_config.conf (100%) rename {script => dolphinscheduler-server/src/main/resources}/config/run_config.conf (100%) delete mode 100644 script/del-zk-node.py delete mode 100644 script/monitor-server.py create mode 100644 script/monitor-server.sh create mode 100644 script/remove-zk-node.sh diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java index 339cb6c548..eafb14b255 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java @@ -36,6 +36,7 @@ public final class Constants { */ public static final String HADOOP_PROPERTIES_PATH = "/common/hadoop/hadoop.properties"; + /** * common properties path */ @@ -1005,4 +1006,5 @@ public final class Constants { public static final String CLASS = "class"; public static final String RECEIVERS = "receivers"; public static final String RECEIVERS_CC = "receiversCc"; + } diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/monitor/AbstractMonitor.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/monitor/AbstractMonitor.java new file mode 100644 index 0000000000..ab30ce890f --- /dev/null +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/monitor/AbstractMonitor.java @@ -0,0 +1,126 @@ +/* + * 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. + */ +package org.apache.dolphinscheduler.server.monitor; + +import org.apache.commons.lang3.StringUtils; +import org.apache.dolphinscheduler.common.utils.CollectionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * abstract server monitor and auto restart server + */ +@Component +public abstract class AbstractMonitor implements Monitor { + + private static final Logger logger = LoggerFactory.getLogger(AbstractMonitor.class); + + + @Autowired + private RunConfig runConfig; + + /** + * monitor server and restart + */ + @Override + public void monitor(String masterPath,String workerPath,Integer port,String installPath) { + try { + restartServer(masterPath,port,installPath); + restartServer(workerPath,port,installPath); + }catch (Exception e){ + logger.error("server start up error",e); + } + } + + private void restartServer(String path,Integer port,String installPath) throws Exception{ + + String type = path.split("/")[2]; + String serverName = null; + String nodes = null; + if ("masters".equals(type)){ + serverName = "master-server"; + nodes = runConfig.getMasters(); + }else if ("workers".equals(type)){ + serverName = "worker-server"; + nodes = runConfig.getWorkers(); + } + + Map activeNodeMap = getActiveNodesByPath(path); + + Set needRestartServer = getNeedRestartServer(getRunConfigServer(nodes), + activeNodeMap.keySet()); + + for (String node : needRestartServer){ + // os.system('ssh -p ' + ssh_port + ' ' + self.get_ip_by_hostname(master) + ' sh ' + install_path + '/bin/dolphinscheduler-daemon.sh start master-server') + String runCmd = "ssh -p " + port + " " + node + " sh " + installPath + "/bin/dolphinscheduler-daemon.sh start " + serverName; + Runtime.getRuntime().exec(runCmd); + } + } + + /** + * get need restart server + * @param deployedNodes deployedNodes + * @param activeNodes activeNodes + * @return need restart server + */ + private Set getNeedRestartServer(Set deployedNodes,Set activeNodes){ + if (CollectionUtils.isEmpty(activeNodes)){ + return deployedNodes; + } + + Set result = new HashSet<>(); + + result.addAll(deployedNodes); + result.removeAll(activeNodes); + + return result; + } + + /** + * run config masters/workers + * @return master set/worker set + */ + private Set getRunConfigServer(String nodes){ + Set nodeSet = new HashSet(); + + + if (StringUtils.isEmpty(nodes)){ + return null; + } + + String[] nodeArr = nodes.split(","); + + for (String node : nodeArr){ + nodeSet.add(node); + } + + return nodeSet; + } + + /** + * get active nodes by path + * @param path path + * @return active nodes + */ + protected abstract Map getActiveNodesByPath(String path); +} diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/monitor/Monitor.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/monitor/Monitor.java new file mode 100644 index 0000000000..3ee9488a3e --- /dev/null +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/monitor/Monitor.java @@ -0,0 +1,28 @@ +/* + * 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. + */ +package org.apache.dolphinscheduler.server.monitor; + +/** + * server monitor and auto restart server + */ +public interface Monitor { + + /** + * monitor server and restart + */ + void monitor(String masterPath, String workerPath, Integer port, String installPath); +} diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/monitor/MonitorServer.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/monitor/MonitorServer.java new file mode 100644 index 0000000000..ac549bc386 --- /dev/null +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/monitor/MonitorServer.java @@ -0,0 +1,63 @@ +/* + * 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. + */ +package org.apache.dolphinscheduler.server.monitor; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.WebApplicationType; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.context.annotation.ComponentScan; + +/** + * monitor server + */ +@ComponentScan("org.apache.dolphinscheduler") +public class MonitorServer implements CommandLineRunner { + + private static Integer ARGS_LENGTH = 4; + + private static final Logger logger = LoggerFactory.getLogger(MonitorServer.class); + + /** + * monitor + */ + @Autowired + private Monitor monitor; + + + + public static void main(String[] args) throws Exception{ + + new SpringApplicationBuilder(MonitorServer.class).web(WebApplicationType.NONE).run(args); + } + + @Override + public void run(String... args) throws Exception { + if (args.length != ARGS_LENGTH){ + logger.error("Usage: "); + return; + } + + String masterPath = args[0]; + String workerPath = args[1]; + Integer port = Integer.parseInt(args[2]); + String installPath = args[3]; + monitor.monitor(masterPath,workerPath,port,installPath); + } +} diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/monitor/RunConfig.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/monitor/RunConfig.java new file mode 100644 index 0000000000..419e9027ea --- /dev/null +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/monitor/RunConfig.java @@ -0,0 +1,85 @@ +/* + * 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. + */ +package org.apache.dolphinscheduler.server.monitor; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.PropertySource; +import org.springframework.stereotype.Component; + +/** + * zookeeper conf + */ +@Component +@PropertySource("classpath:config/run_config.conf") +public class RunConfig { + + //zk connect config + @Value("${masters}") + private String masters; + + @Value("${workers}") + private String workers; + + @Value("${alertServer}") + private String alertServer; + + @Value("${apiServers}") + private String apiServers; + + @Value("${sshPort}") + private String sshPort; + + public String getMasters() { + return masters; + } + + public void setMasters(String masters) { + this.masters = masters; + } + + public String getWorkers() { + return workers; + } + + public void setWorkers(String workers) { + this.workers = workers; + } + + public String getAlertServer() { + return alertServer; + } + + public void setAlertServer(String alertServer) { + this.alertServer = alertServer; + } + + public String getApiServers() { + return apiServers; + } + + public void setApiServers(String apiServers) { + this.apiServers = apiServers; + } + + public String getSshPort() { + return sshPort; + } + + public void setSshPort(String sshPort) { + this.sshPort = sshPort; + } +} \ No newline at end of file diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/monitor/ZKMonitorImpl.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/monitor/ZKMonitorImpl.java new file mode 100644 index 0000000000..927074012d --- /dev/null +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/monitor/ZKMonitorImpl.java @@ -0,0 +1,62 @@ +/* + * 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. + */ +package org.apache.dolphinscheduler.server.monitor; + +import org.apache.dolphinscheduler.common.zk.ZookeeperOperator; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * zk monitor server impl + */ +@Component +public class ZKMonitorImpl extends AbstractMonitor { + + /** + * zookeeper operator + */ + @Autowired + private ZookeeperOperator zookeeperOperator; + + + /** + * get active nodes map by path + * @param path path + * @return active nodes map + */ + @Override + protected Map getActiveNodesByPath(String path) { + + Map maps = new HashMap<>(); + + List childrenList = zookeeperOperator.getChildrenKeys(path); + + if (childrenList == null){ + return maps; + } + + for (String child : childrenList){ + maps.put(child.split("_")[0],child); + } + + return maps; + } +} diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/RemoveZKNode.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/RemoveZKNode.java new file mode 100644 index 0000000000..7264c2f59d --- /dev/null +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/RemoveZKNode.java @@ -0,0 +1,59 @@ +/* + * 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. + */ +package org.apache.dolphinscheduler.server.utils; + +import org.apache.dolphinscheduler.common.zk.ZookeeperOperator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.WebApplicationType; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.context.annotation.ComponentScan; + +@ComponentScan("org.apache.dolphinscheduler") +public class RemoveZKNode implements CommandLineRunner { + + private static Integer ARGS_LENGTH = 1; + + private static final Logger logger = LoggerFactory.getLogger(RemoveZKNode.class); + + + /** + * zookeeper operator + */ + @Autowired + private ZookeeperOperator zookeeperOperator; + + public static void main(String[] args) { + + new SpringApplicationBuilder(RemoveZKNode.class).web(WebApplicationType.NONE).run(args); + } + + @Override + public void run(String... args) throws Exception { + + if (args.length != ARGS_LENGTH){ + logger.error("Usage: "); + return; + } + + zookeeperOperator.remove(args[0]); + zookeeperOperator.close(); + + } +} diff --git a/script/config/install_config.conf b/dolphinscheduler-server/src/main/resources/config/install_config.conf similarity index 100% rename from script/config/install_config.conf rename to dolphinscheduler-server/src/main/resources/config/install_config.conf diff --git a/script/config/run_config.conf b/dolphinscheduler-server/src/main/resources/config/run_config.conf similarity index 100% rename from script/config/run_config.conf rename to dolphinscheduler-server/src/main/resources/config/run_config.conf diff --git a/install.sh b/install.sh index 3699974e00..b73ca09079 100644 --- a/install.sh +++ b/install.sh @@ -469,8 +469,8 @@ sh ${workDir}/script/stop-all.sh # 4,delete zk node echo "4,delete zk node" -sleep 1 -python ${workDir}/script/del-zk-node.py $zkQuorum $zkRoot + +sh ${workDir}/script/remove-zk-node.sh $zkRoot # 5,scp resources echo "5,scp resources" @@ -485,29 +485,4 @@ fi # 6,startup echo "6,startup" -sh ${workDir}/script/start-all.sh - -# 7,start monitoring self-starting script -monitor_pid=${workDir}/monitor_server.pid -if [ "true" = $monitorServerState ];then - if [ -f $monitor_pid ]; then - TARGET_PID=`cat $monitor_pid` - if kill -0 $TARGET_PID > /dev/null 2>&1; then - echo "monitor server running as process ${TARGET_PID}.Stopping" - kill $TARGET_PID - sleep 5 - if kill -0 $TARGET_PID > /dev/null 2>&1; then - echo "monitor server did not stop gracefully after 5 seconds: killing with kill -9" - kill -9 $TARGET_PID - fi - else - echo "no monitor server to stop" - fi - echo "monitor server running as process ${TARGET_PID}.Stopped success" - rm -f $monitor_pid - fi - nohup python -u ${workDir}/script/monitor-server.py $installPath $zkQuorum $zkMasters $zkWorkers > ${workDir}/monitor-server.log 2>&1 & - echo $! > $monitor_pid - echo "start monitor server success as process `cat $monitor_pid`" - -fi \ No newline at end of file +sh ${workDir}/script/start-all.sh \ No newline at end of file diff --git a/script/del-zk-node.py b/script/del-zk-node.py deleted file mode 100644 index 57034a5164..0000000000 --- a/script/del-zk-node.py +++ /dev/null @@ -1,34 +0,0 @@ -# -# 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. -# - -import time -import sys -from kazoo.client import KazooClient - -class ZkClient: - def __init__(self): - self.zk = KazooClient(hosts=sys.argv[1]) - self.zk.start() - def del_node(self): - self.zk.delete(sys.argv[2], recursive=True) - print('deleted success') - def __del__(self): - self.zk.stop() -if __name__ == '__main__': - zkclient = ZkClient() - zkclient.del_node() - time.sleep(2) diff --git a/script/monitor-server.py b/script/monitor-server.py deleted file mode 100644 index 26fcd87de6..0000000000 --- a/script/monitor-server.py +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/env python -# -*- coding:utf-8 -*- -# -# 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. -# - -''' -1, yum install pip -yum -y install python-pip - -2, pip install kazoo -pip install kazoo - -or - -3, conda install kazoo -conda install -c conda-forge kazoo - -run script and parameter description: -nohup python -u monitor_server.py /data1_1T/dolphinscheduler 192.168.xx.xx:2181,192.168.xx.xx:2181,192.168.xx.xx:2181 /dolphinscheduler/masters /dolphinscheduler/workers> monitor_server.log 2>&1 & -the parameters are as follows: -/data1_1T/dolphinscheduler : the value comes from the installPath in install.sh -192.168.xx.xx:2181,192.168.xx.xx:2181,192.168.xx.xx:2181 : the value comes from zkQuorum in install.sh -the value comes from zkWorkers in install.sh -/dolphinscheduler/masters : the value comes from zkMasters in install.sh -/dolphinscheduler/workers : the value comes from zkWorkers in install.sh -''' -import sys -import socket -import os -import sched -import time -from datetime import datetime -from kazoo.client import KazooClient - -schedule = sched.scheduler(time.time, time.sleep) - -class ZkClient: - def __init__(self): - # hosts configuration zk address cluster - self.zk = KazooClient(hosts=zookeepers) - self.zk.start() - - # read configuration files and assemble them into a dictionary - def read_file(self,path): - with open(path, 'r') as f: - dict = {} - for line in f.readlines(): - arr = line.strip().split('=') - if (len(arr) == 2): - dict[arr[0]] = arr[1] - return dict - - # get the ip address according to hostname - def get_ip_by_hostname(self,hostname): - return socket.gethostbyname(hostname) - - # restart server - def restart_server(self,inc): - config_dict = self.read_file(install_path + '/conf/config/run_config.conf') - - master_list = config_dict.get('masters').split(',') - print master_list - master_list = list(map(lambda item : self.get_ip_by_hostname(item),master_list)) - - worker_list = config_dict.get('workers').split(',') - print worker_list - worker_list = list(map(lambda item: self.get_ip_by_hostname(item), worker_list)) - - ssh_port = config_dict.get("sshPort") - print ssh_port - - if (self.zk.exists(masters_zk_path)): - zk_master_list = [] - zk_master_nodes = self.zk.get_children(masters_zk_path) - for zk_master_node in zk_master_nodes: - zk_master_list.append(zk_master_node.split('_')[0]) - restart_master_list = list(set(master_list) - set(zk_master_list)) - if (len(restart_master_list) != 0): - for master in restart_master_list: - print("master " + self.get_ip_by_hostname(master) + " server has down") - os.system('ssh -p ' + ssh_port + ' ' + self.get_ip_by_hostname(master) + ' sh ' + install_path + '/bin/dolphinscheduler-daemon.sh start master-server') - - if (self.zk.exists(workers_zk_path)): - zk_worker_list = [] - zk_worker_nodes = self.zk.get_children(workers_zk_path) - for zk_worker_node in zk_worker_nodes: - zk_worker_list.append(zk_worker_node.split('_')[0]) - restart_worker_list = list(set(worker_list) - set(zk_worker_list)) - if (len(restart_worker_list) != 0): - for worker in restart_worker_list: - print("worker " + self.get_ip_by_hostname(worker) + " server has down") - os.system('ssh -p ' + ssh_port + ' ' + self.get_ip_by_hostname(worker) + ' sh ' + install_path + '/bin/dolphinscheduler-daemon.sh start worker-server') - - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S")) - schedule.enter(inc, 0, self.restart_server, (inc,)) - # default parameter 60s - def main(self,inc=60): - # the enter four parameters are: interval event, priority (sequence for simultaneous execution of two events arriving at the same time), function triggered by the call, - # the argument to the trigger function (tuple form) - schedule.enter(0, 0, self.restart_server, (inc,)) - schedule.run() -if __name__ == '__main__': - if (len(sys.argv) < 4): - print('please input install_path,zookeepers,masters_zk_path and worker_zk_path') - install_path = sys.argv[1] - zookeepers = sys.argv[2] - masters_zk_path = sys.argv[3] - workers_zk_path = sys.argv[4] - zkClient = ZkClient() - zkClient.main(300) \ No newline at end of file diff --git a/script/monitor-server.sh b/script/monitor-server.sh new file mode 100644 index 0000000000..05d46048aa --- /dev/null +++ b/script/monitor-server.sh @@ -0,0 +1,52 @@ +#!/bin/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. +# + +print_usage(){ + printf $"USAGE:$0 masterPath workerPath port installPath\n" + exit 1 +} + +if [ $# -ne 4 ];then + print_usage +fi + +masterPath=$1 +workerPath=$2 +port=$3 +installPath=$4 + + +BIN_DIR=`dirname $0` +BIN_DIR=`cd "$BIN_DIR"; pwd` +DOLPHINSCHEDULER_HOME=$BIN_DIR/.. + +export JAVA_HOME=$JAVA_HOME + + +export DOLPHINSCHEDULER_CONF_DIR=$DOLPHINSCHEDULER_HOME/conf +export DOLPHINSCHEDULER_LIB_JARS=$DOLPHINSCHEDULER_HOME/lib/* + +export DOLPHINSCHEDULER_OPTS="-server -Xmx1g -Xms1g -Xss512k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70" +export STOP_TIMEOUT=5 + +CLASS=org.apache.dolphinscheduler.server.monitor.MonitorServer + +exec_command="$DOLPHINSCHEDULER_OPTS -classpath $DOLPHINSCHEDULER_CONF_DIR:$DOLPHINSCHEDULER_LIB_JARS $CLASS $masterPath $workerPath $port $installPath" + +cd $DOLPHINSCHEDULER_HOME +$JAVA_HOME/bin/java $exec_command diff --git a/script/remove-zk-node.sh b/script/remove-zk-node.sh new file mode 100644 index 0000000000..1fff1d5597 --- /dev/null +++ b/script/remove-zk-node.sh @@ -0,0 +1,48 @@ +#!/bin/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. +# + +print_usage(){ + printf $"USAGE:$0 rootNode\n" + exit 1 +} + +if [ $# -ne 1 ];then + print_usage +fi + +rootNode=$1 + +BIN_DIR=`dirname $0` +BIN_DIR=`cd "$BIN_DIR"; pwd` +DOLPHINSCHEDULER_HOME=$BIN_DIR/.. + +export JAVA_HOME=$JAVA_HOME + + +export DOLPHINSCHEDULER_CONF_DIR=$DOLPHINSCHEDULER_HOME/conf +export DOLPHINSCHEDULER_LIB_JARS=$DOLPHINSCHEDULER_HOME/lib/* + +export DOLPHINSCHEDULER_OPTS="-server -Xmx1g -Xms1g -Xss512k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70" +export STOP_TIMEOUT=5 + +CLASS=org.apache.dolphinscheduler.server.utils.RemoveZKNode + +exec_command="$DOLPHINSCHEDULER_OPTS -classpath $DOLPHINSCHEDULER_CONF_DIR:$DOLPHINSCHEDULER_LIB_JARS $CLASS $rootNode" + +cd $DOLPHINSCHEDULER_HOME +$JAVA_HOME/bin/java $exec_command