做教育网站的er图,wordpress登录 无响应,网站系统开发方式,iis 添加网站使用shell脚本一键安装配置dolphinscheduler
前言#xff1a;使用此脚本可以帮助您自动下载安装配置dolphinscheduler单机版#xff0c;包括设置MySQL保存元数据。自动下载、解压dolphinscheduler安装包#xff0c;自动修改dolphinscheduler的配置#xff0c;配置MySQL连接…使用shell脚本一键安装配置dolphinscheduler
前言使用此脚本可以帮助您自动下载安装配置dolphinscheduler单机版包括设置MySQL保存元数据。自动下载、解压dolphinscheduler安装包自动修改dolphinscheduler的配置配置MySQL连接初始化数据库。 使用准备需要已经安装wget和MySQL5.7把脚本中的以下配置修改为自己的即可使用
#dolphinscheduler安装目录
installDir/opt/module
#dolphinscheduler安装版本
version3.1.5
#MySQL驱动jar包版本必须8.0.16及其以上
mysql_connector_version8.0.16
#MySQL主机ip地址
mysql_ip192.168.198.101
#MySQL用户名
mysql_userroot
#MySQL密码
mysql_passwordroot1. 把下面的脚本复制保存为/tmp/install_dolphinscheduler.sh文件
#!/bin/bash# dolphinscheduler安装目录
installDir/opt/module
# dolphinscheduler安装版本
version3.1.5
# MySQL驱动jar包版本必须8.0.16及其以上
mysql_connector_version8.0.16
# MySQL主机ip地址
mysql_ip192.168.198.101
# MySQL用户名
mysql_userroot
# MySQL密码
mysql_passwordroot
# 要创建的数据库名
db_namedolphinscheduler# 数据库设置操作
# 检查数据库是否存在
check_database$(mysql -h $mysql_ip -u$mysql_user -p$mysql_password -e SHOW DATABASES LIKE $db_name; | grep $db_name)
sleep 1
if [ $? -eq 0 ]; thenecho 检查数据库成功if [ -n $check_database ]; then# 数据库存在删除数据库mysql -h $mysql_ip -u$mysql_user -p$mysql_password -e DROP DATABASE $db_name;echo 数据库已删除fi
elseecho 检查数据库失败请检查数据库信息是否正确即将退出exit 1
fi# 创建数据库
mysql -h $mysql_ip -u$mysql_user -p$mysql_password -e CREATE DATABASE $db_name DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
if [ $? -eq 0 ]; thenecho 数据库已创建
elseecho 数据库创建失败请再次尝试执行此脚本即将退出exit 1
fi
mysql -h $mysql_ip -u$mysql_user -p$mysql_password -e GRANT ALL PRIVILEGES ON $db_name.* TO $mysql_user% IDENTIFIED BY $mysql_password;
# mysql -h $mysql_ip -u$mysql_user -p$mysql_password -e GRANT ALL PRIVILEGES ON $db_name.* TO $mysql_userlocalhost IDENTIFIED BY $mysql_password;
mysql -h $mysql_ip -u$mysql_user -p$mysql_password -e flush privileges;
if [ $? -eq 0 ]; thenecho 数据库已创建
elseecho 数据库创建失败请再次尝试执行此脚本即将退出exit 1
fi# dolphinscheduler安装操作
if test -f /tmp/apache-dolphinscheduler-$version-bin.tar.gz; thenecho /tmp/apache-dolphinscheduler-$version-bin.tar.gz已存在即将进行解压
elsewget https://archive.apache.org/dist/dolphinscheduler/$version/apache-dolphinscheduler-$version-bin.tar.gz -P /tmpif [ $? -eq 0 ]; thenecho dolphinscheduler下载成功elseecho dolphinscheduler下载失败请手动下载到/tmp目录下再次执行次脚本echo 下载地址https://archive.apache.org/dist/dolphinscheduler/3.1.5/apache-dolphinscheduler-3.1.5-bin.tar.gzexit 1fi
fiif test -d ${installDir}/apache-dolphinscheduler-$version-bin; thenecho 正在删除原来的dolphinscheduler...sudo rm -rf ${installDir}/apache-dolphinscheduler-$version-bin
fi
tar -zxvf /tmp/apache-dolphinscheduler-$version-bin.tar.gz -C $installDir
if [ $? -eq 0 ]; thenecho 解压成功
elseecho 解压失败请再次尝试执行此脚本即将退出exit 1
fiif test -f /tmp/mysql-connector-java-$mysql_connector_version.jar; thenecho /tmp/mysql-connector-java-$mysql_connector_version.jar已存在
elsewget https://repo1.maven.org/maven2/mysql/mysql-connector-java/$mysql_connector_version/mysql-connector-java-$mysql_connector_version.jar -P /tmpif [ $? -eq 0 ]; thenecho mysql驱动下载成功elseecho mysql驱动下载失败请手动下载到/tmp目录下再次执行次脚本echo 下载地址https://repo1.maven.org/maven2/mysql/mysql-connector-java/$mysql_connector_version/mysql-connector-java-$mysql_connector_version.jarexit 1fi
fi
cp /tmp/mysql-connector-java-$mysql_connector_version.jar $installDir/apache-dolphinscheduler-$version-bin/worker-server/libs
cp /tmp/mysql-connector-java-$mysql_connector_version.jar $installDir/apache-dolphinscheduler-$version-bin/api-server/libs
cp /tmp/mysql-connector-java-$mysql_connector_version.jar $installDir/apache-dolphinscheduler-$version-bin/alert-server/libs
cp /tmp/mysql-connector-java-$mysql_connector_version.jar $installDir/apache-dolphinscheduler-$version-bin/master-server/libs
cp /tmp/mysql-connector-java-$mysql_connector_version.jar $installDir/apache-dolphinscheduler-$version-bin/tools/libs
cp /tmp/mysql-connector-java-$mysql_connector_version.jar $installDir/apache-dolphinscheduler-$version-bin/standalone-server/libs/standalone-server
if [ $? -eq 0 ]; thenecho mysql驱动复制成功
elseecho mysql驱动复制失败即将退出exit 1
fidolphinschedulerenv\
# Database related configuration, set database type, username and password\
export DATABASE${DATABASE:-mysql}\
export SPRING_PROFILES_ACTIVE${DATABASE}\
export SPRING_DATASOURCE_URLjdbc:mysql://$mysql_ip:3306/dolphinscheduler?useUnicodetruecharacterEncodingUTF-8useSSLfalse\
export SPRING_DATASOURCE_USERNAMEE$mysql_user\
export SPRING_DATASOURCE_PASSWORD\$mysql_password\\
\
# DolphinScheduler server related configurationapplicationyaml\driver-class-name: com.mysql.cj.jdbc.Driver\url: jdbc:mysql://$mysql_ip:3306/dolphinscheduler?useUnicodetruecharacterEncodingUTF-8\username: $mysql_user\password: \$mysql_password\applicationyaml_tools\driver-class-name: com.mysql.cj.jdbc.Driver\url: jdbc:mysql://$mysql_ip:3306/dolphinscheduler?useUnicodetruecharacterEncodingUTF-8applicationyaml2\schema-locations: classpath:sql/dolphinscheduler_mysql.sql\datasource:\driver-class-name: com.mysql.cj.jdbc.Driver\url: jdbc:mysql://$mysql_ip:3306/dolphinscheduler?useUnicodetruecharacterEncodingUTF-8\username: $mysql_user\password: \$mysql_password\sed -i /# Database related configuration/,/# DolphinScheduler server related configuration/c $dolphinschedulerenv $installDir/apache-dolphinscheduler-$version-bin/bin/env/dolphinscheduler_env.sh
if [ $? -eq 0 ]; thenecho dolphinscheduler_env.sh修改成功
elseecho dolphinscheduler_env.sh修改失败即将退出exit 1
fi
sed -i /# Database related configuration/,/# DolphinScheduler server related configuration/c $dolphinschedulerenv $installDir/apache-dolphinscheduler-$version-bin/standalone-server/conf/dolphinscheduler_env.sh
if [ $? -eq 0 ]; thenecho standalone-server/conf/dolphinscheduler_env.sh修改成功
elseecho standalone-server/conf/dolphinscheduler_env.sh修改失败即将退出exit 1
fi
sed -i /# Database related configuration/,/# DolphinScheduler server related configuration/c $dolphinschedulerenv $installDir/apache-dolphinscheduler-$version-bin/alert-server/conf/dolphinscheduler_env.sh
if [ $? -eq 0 ]; thenecho alert-server/conf/dolphinscheduler_env.sh修改成功
elseecho alert-server/conf/dolphinscheduler_env.sh修改失败即将退出exit 1
fi
sed -i /# Database related configuration/,/# DolphinScheduler server related configuration/c $dolphinschedulerenv $installDir/apache-dolphinscheduler-$version-bin/worker-server/conf/dolphinscheduler_env.sh
if [ $? -eq 0 ]; thenecho worker-server/conf/dolphinscheduler_env.sh修改成功
elseecho worker-server/conf/dolphinscheduler_env.sh修改失败即将退出exit 1
fi
sed -i /# Database related configuration/,/# DolphinScheduler server related configuration/c $dolphinschedulerenv $installDir/apache-dolphinscheduler-$version-bin/api-server/conf/dolphinscheduler_env.sh
if [ $? -eq 0 ]; thenecho api-server/conf/dolphinscheduler_env.sh修改成功
elseecho api-server/conf/dolphinscheduler_env.sh修改失败即将退出exit 1
fi
sed -i /# Database related configuration/,/# DolphinScheduler server related configuration/c $dolphinschedulerenv $installDir/apache-dolphinscheduler-$version-bin/master-server/conf/dolphinscheduler_env.sh
if [ $? -eq 0 ]; thenecho master-server/conf/dolphinscheduler_env.sh修改成功
elseecho master-server/conf/dolphinscheduler_env.sh修改失败即将退出exit 1
fi
sed -i / driver-class-name: com.mysql/,/ password: root/c $applicationyaml $installDir/apache-dolphinscheduler-$version-bin/standalone-server/conf/application.yaml
if [ $? -eq 0 ]; thenecho conf/application.yaml修改成功
elseecho conf/application.yaml修改失败即将退出exit 1
fised -i / schema-locations: classpath:sql\/dolphinscheduler_h2.sql/,/ password: /c $applicationyaml2 $installDir/apache-dolphinscheduler-$version-bin/standalone-server/conf/application.yaml
if [ $? -eq 0 ]; thenecho conf/application.yaml修改成功
elseecho conf/application.yaml修改失败即将退出exit 1
fi
sed -i / driver-class-name: com.mysql/,/ password: root/c $applicationyaml $installDir/apache-dolphinscheduler-$version-bin/worker-server/conf/application.yaml
if [ $? -eq 0 ]; thenecho worker-server/conf/application.yaml修改成功
elseecho worker-server/conf/application.yaml修改失败即将退出exit 1
fi
sed -i / driver-class-name: com.mysql/,/ password: root/c $applicationyaml $installDir/apache-dolphinscheduler-$version-bin/api-server/conf/application.yaml
if [ $? -eq 0 ]; thenecho api-server/conf/application.yaml修改成功
elseecho api-server/conf/application.yaml修改失败即将退出exit 1
fi
sed -i / driver-class-name: com.mysql/,/ password: root/c $applicationyaml $installDir/apache-dolphinscheduler-$version-bin/alert-server/conf/application.yaml
if [ $? -eq 0 ]; thenecho alert-server/conf/application.yaml修改成功
elseecho alert-server/conf/application.yaml修改失败即将退出exit 1
fi
sed -i / driver-class-name: com.mysql/,/ password: root/c $applicationyaml $installDir/apache-dolphinscheduler-$version-bin/master-server/conf/application.yaml
if [ $? -eq 0 ]; thenecho master-server/conf/application.yaml修改成功
elseecho master-server/conf/application.yaml修改失败即将退出exit 1
fi
sed -i / driver-class-name: com.mysql/,/characterEncodingUTF-8/c $applicationyaml_tools $installDir/apache-dolphinscheduler-$version-bin/tools/conf/application.yaml
if [ $? -eq 0 ]; thenecho tools/conf/application.yaml修改成功
elseecho tools/conf/application.yaml修改失败即将退出exit 1
fibash $installDir/apache-dolphinscheduler-$version-bin/tools/bin/upgrade-schema.sh
if [ $? -eq 0 ]; thenecho 初始化数据库成功
elseecho 初始化数据库失败即将退出exit 1
fi# 设置dolphinscheduler用户环境变量
if test -n $(grep #DOLPHINSCHEDULER_HOME ~/.bashrc); thenecho DOLPHINSCHEDULER_HOME已存在
elseecho ~/.bashrcecho #DOLPHINSCHEDULER_HOME ~/.bashrcecho export DOLPHINSCHEDULER_HOME$installDir/apache-dolphinscheduler-$version-bin ~/.bashrcecho export PATH$PATH:$DOLPHINSCHEDULER_HOME/bin ~/.bashrc
fi#rm -f /tmp/mysql-connector-java-$mysql_connector_version.jar
#rm -rf /tmp/apache-dolphinscheduler-$version-bin.tar.gz
echo dolphinscheduler安装完成
$installDir/apache-dolphinscheduler-$version-bin/bin/dolphinscheduler-daemon.sh start standalone-server
if [ $? -eq 0 ]; thenecho dolphinscheduler单机版启动成功ip_addr$(ip addr | grep inet | awk {print $2}| tail -n 1 | grep -oP \d\.\d\.\d\.\d)echo 浏览器访问地址http://$ip_addr:12345/dolphinscheduler/ui/loginecho 登录账号adminecho 登录密码dolphinscheduler123
elseecho dolphinscheduler单机版启动失败请查看日志exit 1
fiexit 02. 增加执行权限
chmod ax /tmp/dolphinscheduler.sh3. 执行/tmp/dolphinscheduler.sh
/tmp/dolphinscheduler.sh执行之后等待下载、安装、配置完成如下图 浏览器访问dolphinschedulerhttp://192.168.198.101:12345/dolphinscheduler 如下图 登录进入如图
4. 加载环境变量
source ~/.bashrc5.启动/停止dolphinscheduler
因为再脚本中已经启动所以不需要再启动 停止dolphinscheduler
dolphinscheduler-daemon.sh stop standalone-server启动dolphinscheduler
dolphinscheduler-daemon.sh start standalone-server本期文章到此结束