将Hive Thrift server 添加到服务后台运行
2013-03-28 14:58
330 查看
1. 将hive 的metastore用mysql连接储存
2 在/etc/init.d/文件夹中编辑文件hive-thrift
新建文件并对文件添加权限
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
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 添加到服务后台运行
- Windows 无法打开“添加打印机”本地打印后台处理程序服务没有运行。请重新启动打印后台处理程序
- 添加打印机,本地打印后台处理程序服务没有运行
- windows7添加打印机时,提示“本地打印机后台处理程序服务没有运行”
- hiveserver添加到linux服务里,开机启动
- hiveserver2 后台运行
- hiveserver2 后台运行
- 添加打印机,本地打印后台处理程序服务没有运行
- C#做后台运行的服务,并添加安装程序
- 解决WINDOWS无法打开“添加打印机”,本地后台打印程序服务没有运行
- Docker中Ubuntu镜像添加openssh-server服务
- 服务程序后台运行代码
- 用来判断服务是否后台运行
- hadoop集群安装与配置--c#调用hive的thrift服务
- golang通过thrift链接hiveserver2
- 如何检查后台服务(Android的Service类)是否正在运行?
- 如何检查Android后台服务线程(Service类)是否正在运行
- Android判断后台服务(Service)是否运行
- 通过hiveserver远程服务构建hive web查询分析工具