Skip to main content

进程自动拉起

安装supervisord

sudo  yum install epel-release
sudo yum install -y supervisor
sudo systemctl disable supervisord # 开机自启动
sudo systemctl start supervisord # 启动supervisord服务
sudo systemctl status supervisord # 查看supervisord服务状态
sudo ps -ef|grep supervisord # 查看是否存在supervisord进程
sudo systemctl stop supervisord

修改各个 start_fe.sh 脚本,去掉最后的 & 符号

vim /data/app/hbase/bin/hbase-daemon.sh
(start)
check_before_start
hbase_rotate_log $HBASE_LOGOUT
hbase_rotate_log $HBASE_LOGGC
echo running $command, logging to $HBASE_LOGOUT
$thiscmd --config "${HBASE_CONF_DIR}" \
# foreground_start $command $args < /dev/null > ${HBASE_LOGOUT} 2>&1 & (去掉后台启动)
foreground_start $command $args < /dev/null > ${HBASE_LOGOUT} 2>&1
disown -h -r
sleep 1; head "${HBASE_LOGOUT}"
;;

创建supervisor进程管理配置文件

sudo vim /etc/supervisord.d/HBaseRegionServer.ini

配置文件添加内容

[program:HBaseRegionServer]
environment = JAVA_HOME="/usr/java/default",HBASE_CONF_DIR="/data/app/hbase/conf"
process_name=HBaseRegionServer
directory=/data/app/hbase
command=/data/app/hbase/bin/hbase-daemon.sh start regionserver
autostart=true
autorestart=true
user=bigdata
numprocs=1
startretries=3
stopasgroup=true
killasgroup=true
startsecs=20
redirect_stderr = true
stdout_logfile_maxbytes = 20MB
stdout_logfile_backups = 10
stdout_logfile=/var/log/supervisor-HBaseRegionServer.log

3.重新加载配置 sudo supervisorctl reread sudo supervisorctl update sudo supervisorctl status sudo supervisorctl start HBaseRegionServer sudo supervisorctl stop HBaseRegionServer sudo supervisorctl restart HBaseRegionServer

查看日志

tail -100 /var/log/supervisor/supervisord.log
tail -100 /var/log/supervisor-HBaseRegionServer.log

手动启动命令

./hbase-daemon.sh stop regionserver
./hbase-daemon.sh start regionserver