文章目录
下载
3.X
进入搭建UI的下载官网:
https://shardingsphere.apache.org/elasticjob/current/cn/downloads/
选择我们对应版本的elastic.job
如果是3.X下载就好了
下载2.X
我用的2.1.5,所以我进入到 Archive repository 查看。
进去之后,发现,没有。。。。
直接网上找,然后我找到了:
https://download.csdn.net/download/weixin_45525272/89748154
然后上传解压运行 start.sh
./start.sh
配置
elastic-job-lite-console-2.1.5\conf目录下是配置文件auth.properties,配置的用户名和密码
登录使用的默认用户名和密码:
用户名:root
密码:root
运行
要将 start.sh
脚本在后台运行,可以使用几种方法,具体取决于你的需求和环境。下面是几种常见的方法:
1. 使用 nohup
命令
nohup
命令可以将进程放到后台运行,并且即使你退出终端会话,进程也会继续运行。
nohup ./start.sh > start.log 2>&1 &
nohup
:忽略挂起信号(使得即使终端关闭,进程也会继续运行)。./start.sh
:要运行的脚本。> start.log 2>&1
:将标准输出和标准错误重定向到start.log
文件中。&
:将进程放到后台。
2. 使用 &
符号
在脚本命令末尾添加 &
符号,将其放到后台运行:
./start.sh &
&
:将进程放到后台。
这种方法比 nohup
更简单,但如果你关闭了终端,后台进程可能会被终止。
3. 使用 screen
或 tmux
工具
screen
和 tmux
是终端多路复用器,可以让你在后台运行程序并在需要时恢复到会话中。
-
使用
screen
:-
启动一个新的
screen
会话:screen -S elasticjob
-
运行你的脚本:
./start.sh
-
退出
screen
会话(脚本会在后台继续运行):- 按
Ctrl+A
,然后按D
(detach)。
- 按
-
重新连接到
screen
会话:screen -r elasticjob
-
-
使用
tmux
:-
启动一个新的
tmux
会话:tmux new -s elasticjob
-
运行你的脚本:
./start.sh
-
退出
tmux
会话(脚本会在后台继续运行):- 按
Ctrl+B
,然后按D
(detach)。
- 按
-
重新连接到
tmux
会话:tmux attach -t elasticjob
-
4. 使用 systemd
服务(对于系统管理员)
如果你希望将脚本作为服务管理,并在系统启动时自动运行,可以创建一个 systemd
服务文件(适用于使用 systemd
的系统)。
-
创建一个服务文件,例如
/etc/systemd/system/elasticjob.service
:[Unit] Description=ElasticJob Lite Console [Service] ExecStart=/path/to/elastic-job-lite-console-2.1.5/bin/start.sh WorkingDirectory=/path/to/elastic-job-lite-console-2.1.5 Restart=always User=youruser [Install] WantedBy=multi-user.target
-
重新加载
systemd
配置并启动服务:sudo systemctl daemon-reload sudo systemctl start elasticjob sudo systemctl enable elasticjob