yum install -y python-devel yum install -y libevent libevent-devel m4 autoconf automake libtool libicu libicu-devel yum install -y gcc gcc-c++ gcc-fortran gcc-info gcc-java gcc-locale gcc-obj-c++ gcc-objc
#安装scribe时需要安装 libtool 2.4 版本
cd /usr/local/src/software tar xzf boost_1_44_0.tar.gz;cd boost_1_44_0/ ./bootstrap.sh --prefix=/usr/local/services/boost ./bjam --prefix=/usr/local/services/boost install echo "/usr/local/services/boost/lib" >> /etc/ld.so.conf ldconfig
yum install -y flex flex-devel gcc cd /usr/local/src/software tar xzf thrift-0.4.0.tar.gz cd thrift-0.4.0/ ./configure --prefix=/usr/local/services/thrift --with-csharp=no --with-java=no --with-erlang=no --with-perl=no --with-php=no --with-php_extension=no --with-ruby=no --with-py=yes --with-libevent --with-boost=/usr/local/services/boost make && make install echo "/usr/local/services/thrift/lib" >> /etc/ld.so.conf ldconfig
cd contrib/fb303/ ./bootstrap.sh --with-boost=/usr/local/services/boost/ ./configure --prefix=/usr/local/services/fb303 --with-boost=/usr/local/services/boost/ --with-thriftpath=/usr/local/services/thrift/ make && make install
cd /usr/local/src/software;tar zxvf facebook-scribe-2ee14d3.tar.gz cd facebook-scribe-2ee14d3/ ./bootstrap.sh --prefix=/usr/local/services/scribe --with-thriftpath=/usr/local/services/thrift/ --with-fb303path=/usr/local/services/fb303/ --with-boost=/usr/local/services/boost/ make && make install
cd /usr/local/services/scribe/ mkdir -p /data/scribe/data mkdir -p /data/scribe/log mkdir -p /data/scribe/logs mkdir -p /usr/local/services/scribe/conf ln -s /data/scribe/logs /usr/local/services/scribe/logs touch /usr/local/services/scribe/logs/scribe_client.log
# 上传3个配置文件 scribe_ctrl、scribe.sh、scribe_client.conf
cd /usr/local/services/scribe/conf
# file scribe.sh # file scribe_client.conf
cat scribe.sh #!/bin/sh export LANG=de_DE.UTF-8 /usr/local/services/scribe/bin/scribed /usr/local/services/scribe/conf/scribe_client.conf 1>/usr/local/services/scribe/logs/scribe_client.log 2>&1 & > scribe.sh
cat scribe_client.conf port=8250 max_msg_per_second=2000000 check_interval=3 <store> category=default type=buffer target_write_size=20480 max_write_interval=1 buffer_send_rate=1 retry_interval=30 retry_interval_range=10 <primary> type=network remote_host=cn.rekoo.net remote_port=8250 </primary> <secondary> type=file fs_type=std file_path=/data/scribe/data base_filename=log max_size=3000000 </secondary> </store> > scribe_client.conf
# file scribe_ctrl
cat scribe_ctrl #!/usr/local/services/python/bin/python ## Copyright (c) 2007-2008 Facebook ## ## Licensed under the Apache License, Version 2.0 (the "License"); ## you may not use this file except in compliance with the License. ## You may obtain a copy of the License at ## ## http://www.apache.org/licenses/LICENSE-2.0 ## ## Unless required by applicable law or agreed to in writing, software ## distributed under the License is distributed on an "AS IS" BASIS, ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## See the License for the specific language governing permissions and ## limitations under the License. ## ## See accompanying file LICENSE or visit the Scribe site at: ## http://developers.facebook.com/scribe/ ‘‘‘scribe_ctrl: A simple script for running and monitoring scribe.‘‘‘ import sys #make this work for facebook environment too isFacebook = 0 if (isFacebook == 1): # put your own path here! sys.path.insert(0, ‘/mytrunk/fbcode-test/common/fb303/scripts‘) import fb303_simple_mgmt else: from fb303_scripts import * # thrift python packages need to be installed import thrift from thrift import protocol, transport from thrift.transport import TTransport from thrift.protocol import TBinaryProtocol if (len(sys.argv) > 2): port = int(sys.argv[2]) else: port = 1463 if (len(sys.argv) > 1): retval = fb303_simple_mgmt.service_ctrl(sys.argv[1], port, trans_factory = TTransport.TFramedTransportFactory(), prot_factory = TBinaryProtocol.TBinaryProtocolFactory()) sys.exit(retval) else: print ‘Usage: scribe_ctrl command [port]‘ print ‘ commands: stop counters status version name alive‘ sys.exit(2)
chmod +x /usr/local/services/scribe/conf/scribe_ctrl; chmod +x /usr/local/services/scribe/conf/scribe.sh
/usr/local/services/scribe/conf/scribe.sh; echo "/usr/local/services/scribe/conf/scribe.sh" >> /etc/rc.d/rc.local
时间: 2024-10-10 20:41:56