设为首页 收藏本站
查看: 386|回复: 0

[经验分享] scribe安装配置

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2014-12-25 08:29:58 | 显示全部楼层 |阅读模式
1. 安装boost。
_______________________________________________________________________________________________________
yum install automake gcc-c++ libevent-devel openssl openssl-devel boost boost-devel bzip2-devel python-devel



注:
1)客户端仅安装boost,thrift即可)
2)yum install boost boost-devel  其他像libevent  openssl之类通常可能已经安装;


==============thrift
wget http://archive.apache.org/dist/thrift/0.9.0/thrift-0.9.0.tar.gz

[iyunv@test230 download]# tar zxvf thrift-0.9.0.tar.gz  && cd thrift-0.9.0
[iyunv@test230 thrift-0.9.0]# ./configure --without-python --without-ruby
[iyunv@test230 thrift-0.9.0]# make && make intall
[iyunv@test230 thrift-0.9.0]# vim /usr/local/include/thrift/Thrift.h
头部添加:
#define HAVE_CONFIG_H


[iyunv@test230 thrift-0.9.0]# cd contrib/fb303
[iyunv@test230 thrift-0.9.0]# ./bootstrap.sh
[iyunv@test230 thrift-0.9.0]# make && make install
[iyunv@test230 download]# cd ../../..

[iyunv@test230 download]# echo '/usr/local/lib' >> /etc/ld.so.conf
[iyunv@test230 download]# ldconfig


==============scribe(服务器端安装)
wget https://github.com/facebookarchive/scribe/archive/master.zip -O scribe-master.zip

[iyunv@test230 download]# unzip scribe-master.zip && cd scribe-master
[iyunv@test230 scribe-master]# ./bootstrap.sh
checking whether the Boost::Filesystem library is available... yes
configure: error: Could not link against  !
[iyunv@test230 scribe-master]# ./bootstrap.sh --with-boost-filesystem=boost_filesystem

[iyunv@test230 scribe-master]# make && make install


配置测试:
[iyunv@test230 scribe-master]# mkdir -p /home/scribe/{bin,conf,log,var}
[iyunv@test230 scribe-master]# cp examples/example1.conf /home/scribe/conf/scribe.conf
[iyunv@test230 scribe-master]# vim /home/scribe/conf/scribe.conf
[iyunv@test230 scribe-master]# mkdir /home/scribe/log/scribetest
启动
/usr/local/bin/scribe -c /home/scribe.conf  >>/home/scribe/var/running.log 2>&1 &


配置文件默认端口号:1463
默认日志文件目录:/home/scribe/log/scribetest

测试生成日志,查看/home/scribe/log/scribetest下的日志是否生成
[iyunv@test230 scribe-master]# echo “test0001” |  ./examples/scribe_cat test
若遇到错误:
No module named thrift.Thrift

在thrift源码目录lib/py下执行语句,安装python库
[iyunv@test230 scribe-master]# cd /home/download/thrift-0.9.0/lib/py
[iyunv@test230 py]# python setup.py install
[iyunv@test230 py]# cd -

[iyunv@test230 scribe-master]# ./examples/scribe_ctrl status
ALIVE
[iyunv@test230 scribe-master]# cp -a examples/scribe_* /home/scribe/bin


++--------------------------------------------------------------------------++


2. 编写脚本控制scribe运行。

[iyunv@test230 ~]# cd /home/scribe/

[iyunv@test230 scribe]# ls

bin  conf  log

[iyunv@test230 scribe]# cat scribe_ctl.sh
   
#!/bin/bash
#
# 2014/11/28

d_scribe_base='/data/svr/scribe'
[ -d ${d_scribe_base}/log ] || mkdir ${d_scribe_base}/log
[ -d ${d_scribe_base}/var ] || mkdir ${d_scribe_base}/var
f_scribed_bin='/usr/local/bin/scribed'

f_conf="${d_scribe_base}/conf/scribe.conf"
f_log="${d_scribe_base}/var/running.log"
f_pid="${d_scribe_base}/var/scribed.pid"


status() {
    echo "UID        PID  PPID  C STIME TTY          TIME CMD"
    ps -ef |grep -v grep |grep scribed --color
    echo ""
}

stop() {
    pid=$(cat ${f_pid})
    if [ -z $pid ]; then
        echo "[+] check if scribed is running?"
    else
        echo "[+] stopping...(PID: $pid)"
        kill $pid
        echo "[-] stopped!"
    fi
    echo ""
}

start() {
    echo "[+] start scribed with config: ${f_conf}"
    ${f_scribed_bin} -c ${f_conf} >>${f_log} 2>&1 &
    pid=$(ps -ef |grep scribed |grep -v grep |awk '{print $2}')
    if [ ! -z $pid ]; then
        echo $pid >${f_pid}
        echo "[-] done!"
    else
        echo '[-] start scribed failed! '
        exit 2
    fi
    echo ""
}

check() {
    pid=$(ps -ef |grep scribed |grep -v grep |awk '{print $2}')
    if [ -z $pid ]; then
        echo "[-] `date` scribed died, try to start it again." >>${f_log}
        start
        status
    fi
}

backup() {
    cd ${d_scribe_base}
    local f_backup="${d_scribe_base}/var/scribe_ctl_$(date +%F).tar.gz"
    echo "[+] backup:"
    tar zcvf ${f_backup} bin/ conf/
    chmod o-r ${f_backup} && ls -lh ${f_backup}
    echo "[-] done!"
    echo ""
}

clean() {
    cd ${d_scribe_base}/log
    echo "[+] ready to compress this files:"
    find primary/* -type f -name "*_[0-9]*[0-9]" -mtime +6 -print |sort
    find primary/* -type f -name "*_[0-9]*[0-9]" -mtime +6 -print |sort |xargs -i gzip {}

    echo "[+] ready to compress this files:"
    find primary/* -type f -name "*_[0-9]*[0-9]" -mtime +6 -print |sort
    find primary/* -type f -name "*_[0-9]*[0-9]" -mtime +6 -print |xargs -i gzip {}

    echo "[-] done!"
}

init_crontab() {
    echo "[+] append coreseek control scripts to /var/spool/cron/$(whoami)"

    cat <<_REM >>/var/spool/cron/$(whoami)

# [scribe]
#
#*/1 * * * * /data/svr/scribe/bin/scribe_ctl.sh check >/dev/null 2>&1 &
#2 0 * * 6 /data/svr/scribe/bin/scribe_ctl.sh clean >/dev/null 2>&1 &

_REM

echo '[-] finished!'
echo '[-] please uncomment related tasks.'
echo ''
echo "#################"
echo '[crontab]'
crontab -l |grep scribe
}


case $1 in
    start)
        start
        status
        ;;
    stop)
        stop
        status
        ;;
    restart)
        stop
        sleep 1
        start
        status
        ;;
    status)
        status
        ;;
    check)
        check
        ;;
    backup)
        backup
        ;;
    clean)
        clean
        ;;
    init)
        init_crontab
        ;;
    *)
        echo "Usage: $0 [start|stop|restart|status|check|backup|clean|init]"
        ;;
esac




运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-38613-1-1.html 上篇帖子: yum使用epel源 下篇帖子: Linux下的快捷键
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表