DolphinScheduler Expansion and Reduction

Expansion

This article describes how to add a new master service or worker service to an existing DolphinScheduler cluster.

  1. Attention: There cannot be more than one master service process or worker service process on a physical machine.
  2. If the physical machine which locate the expansion master or worker node has already installed the scheduled service, check the [1.4 Modify configuration] and edit the configuration file `conf/config/install_config.conf` on ** all ** nodes, add masters or workers parameter, and restart the scheduling cluster.

Basic software installation

  • [required] JDK (version 1.8+): must install, install and configure JAVA_HOME and PATH variables under /etc/profile
  • [optional] If the expansion is a worker node, you need to consider whether to install an external client, such as Hadoop, Hive, Spark Client.
  1. Attention: DolphinScheduler itself does not depend on Hadoop, Hive, Spark, but will only call their Client for the corresponding task submission.

Get Installation Package

  • Check the version of DolphinScheduler used in your existing environment, and get the installation package of the corresponding version, if the versions are different, there may be compatibility problems.
  • Confirm the unified installation directory of other nodes, this article assumes that DolphinScheduler is installed in /opt/ directory, and the full path is /opt/dolphinscheduler.
  • Please download the corresponding version of the installation package to the server installation directory, uncompress it and rename it to dolphinscheduler and store it in the /opt directory.
  • Add database dependency package, this document uses Mysql database, add mysql-connector-java driver package to /opt/dolphinscheduler/lib directory.
  1. # create the installation directory, please do not create the installation directory in /root, /home and other high privilege directories
  2. mkdir -p /opt
  3. cd /opt
  4. # decompress
  5. tar -zxvf apache-dolphinscheduler-3.1.0-bin.tar.gz -C /opt
  6. cd /opt
  7. mv apache-dolphinscheduler-3.1.0-bin dolphinscheduler
  1. Attention: You can copy the installation package directly from an existing environment to an expanded physical machine.

Create Deployment Users

  • Create deployment user on all expansion machines, and make sure to configure sudo-free. If we plan to deploy scheduling on four expansion machines, ds1, ds2, ds3, and ds4, create deployment users on each machine is prerequisite.
  1. # to create a user, you need to log in with root and set the deployment user name, modify it by yourself, the following take `dolphinscheduler` as an example:
  2. useradd dolphinscheduler;
  3. # set the user password, please change it by yourself, the following take `dolphinscheduler123` as an example
  4. echo "dolphinscheduler123" | passwd --stdin dolphinscheduler
  5. # configure sudo password-free
  6. echo 'dolphinscheduler ALL=(ALL) NOPASSWD: NOPASSWD: ALL' >> /etc/sudoers
  7. sed -i 's/Defaults requirett/#Defaults requirett/g' /etc/sudoers
  1. Attention:
  2. - Since it is `sudo -u {linux-user}` to switch between different Linux users to run multi-tenant jobs, the deploying user needs to have sudo privileges and be password free.
  3. - If you find the line `Default requiretty` in the `/etc/sudoers` file, please also comment it out.
  4. - If have needs to use resource uploads, you also need to assign read and write permissions to the deployment user on `HDFS or MinIO`.

Modify Configuration

  • From an existing node such as Master/Worker, copy the configuration directory directly to replace the configuration directory in the new node. After finishing the file copy, check whether the configuration items are correct.

    1. Highlights:
    2. datasource.properties: database connection information
    3. zookeeper.properties: information for connecting zk
    4. common.properties: Configuration information about the resource store (if hadoop is set up, please check if the core-site.xml and hdfs-site.xml configuration files exist).
    5. dolphinscheduler_env.sh: environment Variables
  • Modify the dolphinscheduler_env.sh environment variable in the bin/env/dolphinscheduler_env.sh directory according to the machine configuration (the following is the example that all the used software install under /opt/soft)

    1. export HADOOP_HOME=/opt/soft/hadoop
    2. export HADOOP_CONF_DIR=/opt/soft/hadoop/etc/hadoop
    3. # export SPARK_HOME1=/opt/soft/spark1
    4. export SPARK_HOME2=/opt/soft/spark2
    5. export PYTHON_HOME=/opt/soft/python
    6. export JAVA_HOME=/opt/soft/jav
    7. export HIVE_HOME=/opt/soft/hive
    8. export FLINK_HOME=/opt/soft/flink
    9. export DATAX_HOME=/opt/soft/datax/bin/datax.py
    10. export PATH=$HADOOP_HOME/bin:$SPARK_HOME2/bin:$PYTHON_HOME:$JAVA_HOME/bin:$HIVE_HOME/bin:$PATH:$FLINK_HOME/bin:$DATAX_HOME:$PATH

    Attention: This step is very important, such asJAVA_HOMEandPATHis necessary to configure if haven not used just ignore or comment out

  • Soft link the JDK to /usr/bin/java (still using JAVA_HOME=/opt/soft/java as an example)

    1. sudo ln -s /opt/soft/java/bin/java /usr/bin/java
  • Modify the configuration file conf/config/install_config.conf on the all nodes, synchronizing the following configuration.

    • To add a new master node, you need to modify the IPs and masters parameters.
    • To add a new worker node, modify the IPs and workers parameters.
  1. # which machines to deploy DS services on, separated by commas between multiple physical machines
  2. ips="ds1,ds2,ds3,ds4"
  3. # ssh port,default 22
  4. sshPort="22"
  5. # which machine the master service is deployed on
  6. masters="existing master01,existing master02,ds1,ds2"
  7. # the worker service is deployed on which machine, and specify the worker belongs to which worker group, the following example of "default" is the group name
  8. workers="existing worker01:default,existing worker02:default,ds3:default,ds4:default"
  • If the expansion is for worker nodes, you need to set the worker group, refer to the security of the Worker grouping

  • On all new nodes, change the directory permissions so that the deployment user has access to the DolphinScheduler directory

  1. sudo chown -R dolphinscheduler:dolphinscheduler dolphinscheduler

Restart the Cluster and Verify

  • Restart the cluster
  1. # stop command:
  2. bin/stop-all.sh # stop all services
  3. bash bin/dolphinscheduler-daemon.sh stop master-server # stop master service
  4. bash bin/dolphinscheduler-daemon.sh stop worker-server # stop worker service
  5. bash bin/dolphinscheduler-daemon.sh stop api-server # stop api service
  6. bash bin/dolphinscheduler-daemon.sh stop alert-server # stop alert service
  7. # start command::
  8. bin/start-all.sh # start all services
  9. bash bin/dolphinscheduler-daemon.sh start master-server # start master service
  10. bash bin/dolphinscheduler-daemon.sh start worker-server # start worker service
  11. bash bin/dolphinscheduler-daemon.sh start api-server # start api service
  12. bash bin/dolphinscheduler-daemon.sh start alert-server # start alert service
  1. Attention: When using `stop-all.sh` or `stop-all.sh`, if the physical machine execute the command is not configured to be ssh-free on all machines, it will prompt to enter the password
  • After completing the script, use the jps command to see if every node service is started (jps comes with the Java JDK)
  1. MasterServer ----- master service
  2. WorkerServer ----- worker service
  3. ApiApplicationServer ----- api service
  4. AlertServer ----- alert service

After successful startup, you can view the logs, which are stored in the logs folder.

  1. logs/
  2. ├── dolphinscheduler-alert-server.log
  3. ├── dolphinscheduler-master-server.log
  4. ├── dolphinscheduler-worker-server.log
  5. ├── dolphinscheduler-api-server.log

If the above services start normally and the scheduling system page is normal, check whether there is an expanded Master or Worker service in the [Monitor] of the web system. If it exists, the expansion is complete.


Reduction

The reduction is to reduce the master or worker services for the existing DolphinScheduler cluster. There are two steps for shrinking. After performing the following two steps, the shrinking operation can be completed.

Stop the Service on the Scaled-Down Node

  • If you are scaling down the master node, identify the physical machine where the master service is located, and stop the master service on the physical machine.
  • If scale down the worker node, determine the physical machine where the worker service scale down and stop the worker services on the physical machine.
  1. # stop command:
  2. bin/stop-all.sh # stop all services
  3. bash bin/dolphinscheduler-daemon.sh stop master-server # stop master service
  4. bash bin/dolphinscheduler-daemon.sh stop worker-server # stop worker service
  5. bash bin/dolphinscheduler-daemon.sh stop api-server # stop api service
  6. bash bin/dolphinscheduler-daemon.sh stop alert-server # stop alert service
  7. # start command:
  8. bin/start-all.sh # start all services
  9. bash bin/dolphinscheduler-daemon.sh start master-server # start master service
  10. bash bin/dolphinscheduler-daemon.sh start worker-server # start worker service
  11. bash bin/dolphinscheduler-daemon.sh start api-server # start api service
  12. bash bin/dolphinscheduler-daemon.sh start alert-server # start alert service
  1. Attention: When using `stop-all.sh` or `stop-all.sh`, if the machine without the command is not configured to be ssh-free for all machines, it will prompt to enter the password
  • After the script is completed, use the jps command to see if every node service was successfully shut down (jps comes with the Java JDK)
  1. MasterServer ----- master service
  2. WorkerServer ----- worker service
  3. ApiApplicationServer ----- api service
  4. AlertServer ----- alert service

If the corresponding master service or worker service does not exist, then the master or worker service is successfully shut down.

Modify the Configuration File

  • modify the configuration file conf/config/install_config.conf on the all nodes, synchronizing the following configuration.
    • to scale down the master node, modify the IPs and masters parameters.
    • to scale down worker nodes, modify the IPs and workers parameters.
  1. # which machines to deploy DS services on, "localhost" for this machine
  2. ips="ds1,ds2,ds3,ds4"
  3. # ssh port,default: 22
  4. sshPort="22"
  5. # which machine the master service is deployed on
  6. masters="existing master01,existing master02,ds1,ds2"
  7. # The worker service is deployed on which machine, and specify which worker group this worker belongs to, the following example of "default" is the group name
  8. workers="existing worker01:default,existing worker02:default,ds3:default,ds4:default"