将Hive Thrift server 添加到服务后台运行
来源:互联网 发布:大气环境防护距离软件 编辑:程序博客网 时间:2024/05/29 17:33
1. 将hive 的metastore用mysql连接储存
2 在/etc/init.d/文件夹中编辑文件hive-thrift
- #!/bin/bash
- # init script for Hive Thrift Interface.
- #
- # chkconfig: 2345 90 10
- # description: Hive Thrift Interface
- # Source function library.
- . /etc/rc.d/init.d/functions
- # Paths to configuration, binaries, etc
- HIVE_BIN=/usr/bin/hive
- HIVE_ARGS="--service hiveserver"
- HIVE_LOG=/var/log/hive-thrift.log
- HIVE_USER="hadoop"
- ANT_LIB=/usr/share/java
- if [ ! -f $HIVE_BIN ]; then
- echo "File not found: $HIVE_BIN"
- exit 1
- fi
- # pid file for /sbin/runuser
- pidfile=${PIDFILE-/var/run/hive-thrift.pid}
- # pid file for the java child process.
- pidfile_java=${PIDFILE_JAVA-/var/run/hive-thrift-java.pid}
- RETVAL=0
- start() {
- # check to see if hive is already running by looking at the pid file and grepping
- # the process table.
- if [ -f $pidfile_java ] && checkpid `cat $pidfile_java`; then
- echo "hive-thrift is already running"
- exit 0
- fi
- echo -n $"Starting $prog: "
- /sbin/runuser -s /bin/sh -c "$HIVE_BIN $HIVE_ARGS" $HIVE_USER >> $HIVE_LOG 2>&1 &
- runuser_pid=$!
- echo $runuser_pid > $pidfile
- # sleep so the process can make its way to the process table.
- usleep 500000
- # get the child Java process that /usr/bin/hive started.
- java_pid=$(ps -eo pid,ppid,fname | awk "{ if (\$2 == $runuser_pid && \$3 ~ /java/) { print \$1 } }")
- echo $java_pid > $pidfile_java
- disown -ar
- # print status information.
- ps aux | grep $java_pid &> /dev/null && echo_success || echo_failure
- RETVAL=$?
- echo
- return $RETVAL
- }
- stop() {
- # check if the process is already stopped by seeing if the pid file exists.
- if [ ! -f $pidfile_java ]; then
- echo "hive-thrift is already stopped"
- exit 0
- fi
- echo -n $"Stopping $prog: "
- if kill `cat $pidfile` && kill `cat $pidfile_java`; then
- RETVAL=0
- echo_success
- else
- RETVAL=1
- echo_failure
- fi
- echo
- [ $RETVAL = 0 ] && rm -f ${pidfile} ${pidfile_java}
- }
- status_fn() {
- if [ -f $pidfile_java ] && checkpid `cat $pidfile_java`; then
- echo "hive-thrift is running"
- exit 0
- else
- echo "hive-thrift is stopped"
- exit 1
- fi
- }
- case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- status)
- status_fn
- ;;
- restart)
- stop
- start
- ;;
- *)
- echo $"Usage: $prog {start|stop|restart|status}"
- RETVAL=3
- esac
- exit $RETVAL
新建文件并对文件添加权限
touch /var/run/hive-thrift.pid
touch /var/log/hive-thrift.log
touch /var/run/hive-thrift-java.pid
chown hadoop:hadoop /var/run/hive-thrift.pid
chown hadoop:hadoop /var/log/hive-thrift.log
chown hadoop:hadoop /var/run/hive-thrift-java.pid
将hive-thrift添加到服务中并设置为开机启动
chmod +x /etc/init.d/hive-thrift
chkconfig --add hive-thrift
chkconfig hive-thrift on
- 将Hive Thrift server 添加到服务后台运行
- 将Hive Thrift server 添加到服务后台运行
- Hive的thrift服务
- Hive 的Thrift服务
- 将apache添加到服务
- Hive thrift服务--beeline使用
- 将绿色版Tomcat服务添加到系统服务并设为开机运行
- 将绿色版Tomcat服务添加到系统服务并设为开机运行
- 将绿色版Tomcat服务添加到系统服务并设为开机运行
- 将apusic添加到windows服务
- 将apusic添加到windows服务
- 将memcached添加到系统服务
- CentOS下将apache添加到服务
- win7 将tomcat添加到系统服务
- 【mongoDB】将mongodb添加到服务
- 将tomcat添加到服务中
- 将tomcat、mysql添加到系统服务
- CentOS下 将tomcat 添加到服务
- 快速排序算法实现
- 运行此安装程序之前,必须安装 32 位 Windows 映像处理组件(WIC)解决办法
- VB备忘录(7)类与对象---接口
- ldap文本处理
- 音视频相关系统的开发指南
- 将Hive Thrift server 添加到服务后台运行
- 常用网络命令(六)iptables
- 使用pull解析Xml
- 常用RGB颜色值
- join left join right join outer join 以及笛卡儿积
- APUE学习笔记——第十一章 线程
- 辐射度算法
- Log4Cxx 的使用方法
- Modern C++ Design 笔记 第二章 Chapter 2. Techniques