赞
踩
本文将介绍如何配置免密登录和安装DolphinScheduler。首先,我们将配置root用户和dolphinscheduler用户的免密登录。然后,我们将安装所需的软件和依赖项,包括JDK、MySQL和Zookeeper。接下来,我们将下载并解压DolphinScheduler,并修改安装配置文件。然后,我们将配置MySQL数据源并初始化数据库。最后,我们将使用dolphinscheduler用户安装和部署DolphinScheduler,并通过浏览器登录系统UI。
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
dolphinscheduler用户的密码:dolphinscheduler
创建dolphinscheduler用户,配置sudo权限,并切换到dolphinscheduler用户。
useradd dolphinscheduler
echo "dolphinscheduler" | passwd --stdin dolphinscheduler
sed -i '$adolphinscheduler ALL=(ALL) NOPASSWD: NOPASSWD: ALL' /etc/sudoers
sed -i 's/Defaults requirett/#Defaults requirett/g' /etc/sudoers
su dolphinscheduler
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
exit
下载地址:https://www.oracle.com/java/technologies/downloads/#java8
下载后上传到/tmp目录下。
然后执行下面命令,用于创建目录、解压,并设置系统级环境变量。
mkdir -p /opt/module
tar -zxvf /tmp/jdk-8u401-linux-x64.tar.gz -C /opt/module/
echo >> /etc/profile
echo '#JAVA_HOME' >> /etc/profile
echo "export JAVA_HOME=/opt/module/jdk1.8.0_401" >> /etc/profile
echo 'export PATH=$PATH:$JAVA_HOME/bin' >> /etc/profile
source /etc/profile
在hadoop101安装MySQL。
之前使用3.1.4部署之后,安装dolphinscheduler一直报错。更换版本到3.8.1后,解决了一些报错问题。
wget --no-check-certificate https://archive.apache.org/dist/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz -P /tmp
mkdir -p /opt/module/zookeeper
tar -zxvf /tmp/zookeeper-3.4.6.tar.gz -C /opt/module/zookeeper
echo >> /etc/profile
echo '#ZOOKEEPER_HOME' >> /etc/profile
echo 'export ZOOKEEPER_HOME=/opt/module/zookeeper/zookeeper-3.4.6' >> /etc/profile
echo 'export PATH=$PATH:$ZOOKEEPER_HOME/bin' >> /etc/profile
source /etc/profile
cd /opt/module/zookeeper/zookeeper-3.4.6
cp ./conf/zoo_sample.cfg ./conf/zoo.cfg
sed -i "s|^dataDir=.*|dataDir=./tmp/zookeeper|" ./conf/zoo.cfg
sed -i "s|^clientPort=.*|clientPort=12181|" ./conf/zoo.cfg
wget --no-check-certificate https://archive.apache.org/dist/zookeeper/zookeeper-3.8.1/apache-zookeeper-3.8.1-bin.tar.gz -P /tmp
mkdir -p /opt/soft/zookeeper
tar -zxvf /tmp/apache-zookeeper-3.8.1-bin.tar.gz -C /opt/soft/zookeeper
cd /opt/soft/zookeeper/apache-zookeeper-3.8.1-bin
cp ./conf/zoo_sample.cfg ./conf/zoo.cfg
sed -i "s|^dataDir=.*|dataDir=./tmp/zookeeper|" ./conf/zoo.cfg
sed -i "s|^clientPort=.*|clientPort=12181|" ./conf/zoo.cfg
cd /opt/soft/zookeeper/apache-zookeeper-3.8.1-bin
./bin/zkServer.sh start
查看是否启动成功。
./bin/zkServer.sh status
启动成功如下图所示。
cd /opt/soft/zookeeper/apache-zookeeper-3.8.1-bin
./bin/zkServer.sh start
cd /opt/soft/zookeeper/apache-zookeeper-3.8.1-bin
./bin/zkServer.sh stop
cd /opt/soft/zookeeper/apache-zookeeper-3.8.1-bin
./bin/zkServer.sh restart
cd /opt/soft/zookeeper/apache-zookeeper-3.8.1-bin
./bin/zkServer.sh status
cd /opt/soft/zookeeper/apache-zookeeper-3.8.1-bin
./bin/zkCli.sh -server localhost:12181
wget --no-check-certificate https://archive.apache.org/dist/dolphinscheduler/3.1.4/apache-dolphinscheduler-3.1.4-bin.tar.gz -P /tmp
mkdir -p /opt/soft/dolphinscheduler
tar -zxvf /tmp/apache-dolphinscheduler-3.1.4-bin.tar.gz -C /opt/soft/dolphinscheduler
修改 /opt/soft/dolphinscheduler/apache-dolphinscheduler-3.1.4-bin/bin/env/install_env.sh
文件。内容如下所示。
# 需要安装DolphinScheduler相关组件的主机 ips=${ips:-"localhost"} # SSH协议端口号,默认为22。 sshPort=${sshPort:-"22"} # 需要安装master节点的主机 masters=${masters:-"localhost"} # 需要安装worker节点的主机 workers=${workers:-"localhost:default"} # 需要安装警报服务的主机 alertServer=${alertServer:-"localhost"} # 需要安装api服务的主机 apiServers=${apiServers:-"localhost"} # 安装dolphinscheduler的目录。如果不存在,将由install.sh脚本创建。 installPath=${installPath:-"/opt/soft/dolphinscheduler/dolphinscheduler"} # 部署dolphinscheduler的用户 deployUser=${deployUser:-"root"} # zookeeper的根目录,目前DolphinScheduler默认的注册服务器是zookeeper。 zkRoot=${zkRoot:-"/dolphinscheduler"}
修改 /opt/soft/dolphinscheduler/apache-dolphinscheduler-3.1.4-bin/bin/env/dolphinscheduler_env.sh
文件。内容如下所示。
# 修改为自己的jdk安装目录 export JAVA_HOME=${JAVA_HOME:-/opt/module/jdk1.8.0_391} # 修改MySQL配置 export DATABASE=${DATABASE:-mysql} export SPRING_PROFILES_ACTIVE=${DATABASE} export SPRING_DATASOURCE_URL="jdbc:mysql://localhost:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8&useSSL=false" export SPRING_DATASOURCE_USERNAME="dolphinscheduler" export SPRING_DATASOURCE_PASSWORD="dolphinscheduler" # DolphinScheduler服务相关配置 export SPRING_CACHE_TYPE=${SPRING_CACHE_TYPE:-none} export SPRING_JACKSON_TIME_ZONE=${SPRING_JACKSON_TIME_ZONE:-UTC} export MASTER_FETCH_COMMAND_NUM=${MASTER_FETCH_COMMAND_NUM:-10} # 注册中心配置,修改为自己的zookeeper监听地址 export REGISTRY_TYPE=${REGISTRY_TYPE:-zookeeper} export REGISTRY_ZOOKEEPER_CONNECT_STRING=${REGISTRY_ZOOKEEPER_CONNECT_STRING:-localhost:12181} # 这些环境变量根据自己的需要更改,没有保持默认即口 export HADOOP_HOME=${HADOOP_HOME:-/opt/soft/hadoop} export HADOOP_CONF_DIR=${HADOOP_CONF_DIR:-/opt/soft/hadoop/etc/hadoop} export SPARK_HOME1=${SPARK_HOME1:-/opt/soft/spark1} export SPARK_HOME2=${SPARK_HOME2:-/opt/soft/spark2} export PYTHON_HOME=${PYTHON_HOME:-/opt/soft/python} export HIVE_HOME=${HIVE_HOME:-/opt/soft/hive} export FLINK_HOME=${FLINK_HOME:-/opt/soft/flink} export DATAX_HOME=${DATAX_HOME:-/opt/soft/datax} export SEATUNNEL_HOME=${SEATUNNEL_HOME:-/opt/soft/seatunnel} export CHUNJUN_HOME=${CHUNJUN_HOME:-/opt/soft/chunjun} export PATH=$HADOOP_HOME/bin:$SPARK_HOME1/bin:$SPARK_HOME2/bin:$PYTHON_HOME/bin:$JAVA_HOME/bin:$HIVE_HOME/bin:$FLINK_HOME/bin:$DATAX_HOME/bin:$SEATUNNEL_HOME/bin:$CHUNJUN_HOME/bin:$PATH
修改安全策略为LOW,使其可以设置简单密码,根据自己的需要更改。
mysql -h localhost -P 3306 -uroot -proot -e "set global validate_password_length=4;"
mysql -h localhost -P 3306 -uroot -proot -e "set global validate_password_policy=LOW;"
查看dolphinscheduler数据库是否存在。
mysql -h localhost -P 3306 -uroot -proot -e "SHOW DATABASES;" | grep dolphinscheduler
若存在则删除。
mysql -h localhost -P 3306 -uroot -proot -e "DROP DATABASE dolphinscheduler;"
创建dolphinscheduler数据库
mysql -h localhost -P 3306 -uroot -proot -e "CREATE DATABASE dolphinscheduler DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;"
创建 dolphinscheduler 用户并授予操作 dolphinscheduler 数据库的权限。
此处创建dolphinscheduler用户并设置密码为dolphinscheduler。
mysql -h localhost -P 3306 -uroot -proot -e "CREATE USER 'dolphinscheduler'@'%' IDENTIFIED BY 'dolphinscheduler';"
授予操作 dolphinscheduler 数据库的权限并刷新权限。
mysql -h localhost -P 3306 -uroot -proot -e "GRANT ALL PRIVILEGES ON dolphinscheduler.* TO 'dolphinscheduler'@'%' IDENTIFIED BY 'dolphinscheduler';"
mysql -h localhost -P 3306 -uroot -proot -e "flush privileges;"
下载并配置MySQL驱动。
wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.16/mysql-connector-java-8.0.16.jar -P /tmp
cd /opt/soft/dolphinscheduler/apache-dolphinscheduler-3.1.4-bin
cp /tmp/mysql-connector-java-8.0.16.jar ./worker-server/libs
cp /tmp/mysql-connector-java-8.0.16.jar ./api-server/libs
cp /tmp/mysql-connector-java-8.0.16.jar ./alert-server/libs
cp /tmp/mysql-connector-java-8.0.16.jar ./master-server/libs
cp /tmp/mysql-connector-java-8.0.16.jar ./tools/libs
cp /tmp/mysql-connector-java-8.0.16.jar ./standalone-server/libs/standalone-server
wget https://repo1.maven.org/maven2/commons-cli/commons-cli/1.5.0/commons-cli-1.5.0.jar -P /tmp
cd /opt/soft/dolphinscheduler/apache-dolphinscheduler-3.1.4-bin
cp /tmp/commons-cli-1.5.0.jar ./worker-server/libs
cp /tmp/commons-cli-1.5.0.jar ./api-server/libs
cp /tmp/commons-cli-1.5.0.jar ./alert-server/libs
cp /tmp/commons-cli-1.5.0.jar ./master-server/libs
cp /tmp/commons-cli-1.5.0.jar ./tools/libs
初始化dolphinscheduler数据库。
cd /opt/soft/dolphinscheduler/apache-dolphinscheduler-3.1.4-bin
bash tools/bin/upgrade-schema.sh
初始化成功如下图所示。
修改apache-dolphinscheduler-3.1.4-bin目录权限到dolphinscheduler用户。
cd /opt/soft/dolphinscheduler
chown -R dolphinscheduler:dolphinscheduler apache-dolphinscheduler-3.1.4-bin
cd /opt/soft/dolphinscheduler/apache-dolphinscheduler-3.1.4-bin
bash ./bin/install.sh
浏览器访问地址 http://localhost:12345/dolphinscheduler/ui 即可登录系统UI。默认的用户名和密码是 admin/dolphinscheduler123
如下图所示。
cd /opt/soft/dolphinscheduler/apache-dolphinscheduler-3.1.4-bin
bash ./bin/stop-all.sh
cd /opt/soft/dolphinscheduler/apache-dolphinscheduler-3.1.4-bin
bash ./bin/start-all.sh
cd /opt/soft/dolphinscheduler/apache-dolphinscheduler-3.1.4-bin
bash ./bin/dolphinscheduler-daemon.sh stop master-server
bash ./bin/dolphinscheduler-daemon.sh start master-server
cd /opt/soft/dolphinscheduler/apache-dolphinscheduler-3.1.4-bin
bash ./bin/dolphinscheduler-daemon.sh start worker-server
bash ./bin/dolphinscheduler-daemon.sh stop worker-server
cd /opt/soft/dolphinscheduler/apache-dolphinscheduler-3.1.4-bin
bash ./bin/dolphinscheduler-daemon.sh start api-server
bash ./bin/dolphinscheduler-daemon.sh stop api-server
cd /opt/soft/dolphinscheduler/apache-dolphinscheduler-3.1.4-bin
bash ./bin/dolphinscheduler-daemon.sh start alert-server
bash ./bin/dolphinscheduler-daemon.sh stop alert-server
本文介绍了配置免密登录和安装DolphinScheduler的详细步骤。通过配置免密登录,可以方便地进行远程登录和操作。安装DolphinScheduler需要满足一些前提条件,如安装JDK、MySQL和Zookeeper。在安装过程中,我们修改了安装配置文件并配置了MySQL数据源。最后,我们使用dolphinscheduler用户完成了DolphinScheduler的安装和部署,并通过浏览器登录了系统UI。
希望本教程对您有所帮助!如有任何疑问或问题,请随时在评论区留言。感谢阅读!
参考链接:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。