欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

【若泽大数据实战第十八天】Hadoop MySQL 服务自启动配置

程序员文章站 2024-03-22 16:18:46
...

配置MySQL服务自启动

[aaa@qq.com ~]# cd /usr/local/mysql#将服务文件拷贝到init.d下,并重命名为mysql
[aaa@qq.com mysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysql 
#赋予可执行权限
[aaa@qq.com mysql]# chmod +x /etc/rc.d/init.d/mysql
#删除服务
[aaa@qq.com mysql]# chkconfig --del mysql
#添加服务
[aaa@qq.com mysql]# chkconfig --add mysql
[aaa@qq.com mysql]# chkconfig --level 345 mysql on
[aaa@qq.com mysql]# vi /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.


touch /var/lock/subsys/local


su - mysqladmin -c "/etc/init.d/mysql start --federated"


"/etc/rc.local" 9L, 278C written

配置 Hadoop 服务自启动

1、进入到/etc/init.d目录下,编辑一个新的脚本文件hadoop
# cd /etc/init.d
# vi hadoop
2、编辑脚本文件hadoop
#!/bin/bash
#chkconfig:345
#description:script to start/stop hadoop
su - hadoop <<!
case $1 in
start)
sh /home/hadoop/app/hadoop-2.6.0-cdh5.7.0/sbin/start-all.sh
;;
stop)
sh /home/hadoop/app/hadoop-2.6.0-cdh5.7.0/sbin/stop-all.sh
;;
*)
echo "Usage:$0(start|stop)"
;;
esac
exit
!
3、保存退出,用chmod修改该文件权限
# chmod -R 775 hadoop
4、设置hadoop为开机自启动# chkconfig --add hadoop # chkconfig --level 345 hadoop on

大数据课程推荐:

【若泽大数据实战第十八天】Hadoop MySQL 服务自启动配置