`
vanadiumlin
  • 浏览: 492657 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

starling 的安装与使用(不推荐使用,已不更新)

 
阅读更多

系统环境 windows

首先第一步是安装ruby

http://rubyforge.org/frs/?group_id=167

下载  dev-kit

https://github.com/oneclick/rubyinstaller/downloads/

安装dev-kit

ruby dk.rb init

ruby dk.rb install

安装 eventmachine 和thin

http://rubyforge.org/frs/?group_id=1555

 

 

gem install specific_install

 


gem install eventmachine --pre
gem install thin ignore-dependencies
gem install thin

运行 gem  安装starling

gem install  starling

接下来是自动安装

 

Fetching: memcache-client-1.8.5.gem (100%)

Fetching: eventmachine-0.12.10.gem (100%)

 

输入 starling   运行程序

 

Starting at 127.0.0.1:22122.

I, [2012-03-19T14:22:30.531250 #400]  INFO -- : Starling STARTUP on 127.0.0.1:22

122

 

 

 

开源的memcached Java客户端——xmemcached发布1.3.6版本。

主要改进如下:

1.  为MemcachedClientBuilder添加两个新方法用于配置:

public void setConnectTimeout(long connectTimeout); 
public void setSanitizeKeys(boolean sanitizeKeys); 

2.  用于hibernate的XmemcachedClientFactoryd添加了connectTimeout属性,感谢网友 Boli.Jiang的贡献。

3.  添加新的枚举类型 net.rubyeye.xmemcached.transcoders.CompressionMode,用于指定 Transcoder的压缩类型,默认是ZIP压缩,可选择GZIP压缩。Transcoder接口添加setCompressionMode方法。

4.  修改心跳规则,原来是在连接空闲的时候发起心跳,现在变成固定每隔5秒发起一次心跳检测连接。

5.  修改默认参数,默认禁用nagle算法,默认将批量get的合并因子下降到50。

6.  修复bug和改进,包括:161163165169172、173176179180

 

项目主页:http://code.google.com/p/xmemcached/

项目文档:http://code.google.com/p/xmemcached/w/list

下载:http://code.google.com/p/xmemcached/downloads/list

源码:https://github.com/killme2008/xmemcached

 

 

Twitter的团队新近将后台服务器用ruby实现的消息队列服务器starling开放源代码了。
下载地址:
http://rubyforge.org/projects/starling/

基于memcache协议,可以使用任何客户端(java, c++, .net, php, ruby...)调用
更多信息:
http://dev.twitter.com/2008/01/announcing-starling.html 



系统环境 centos

先安装git,源码编译即可:

wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz

autoconf  (解压包里面)

./configure  ( 解压包里面 )

make 

sudo make install

 

再通过rvm来安装ruby:

yum install gcc-c++

bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )

echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile

source .bash_profile  (用户根目录) 使用ls -a

type rvm | head -1

rvm install 1.9.2

rvm --default 1.9.2 

会自动安装rubygem1.8.10

安装gems
This post will explain how to install RubyGems 1.2 on the server running CentOS 4.

Following instructions from the install section of the RubyGems User Guide:

http://www.rubygems.org/read/chapter/3

[root@monster tmp]# yum -y install ruby ruby-devel irb
...
[root@monster tmp]# wget http://rubyforge.org/frs/download.php/38646/rubygems-1.2.0.tgz
...
[root@monster tmp]# tar xvfzp rubygems-1.2.0.tgz
...
[root@monster tmp]# cd rubygems-1.2.0
[root@monster rubygems-1.2.0]# ruby setup.rb 
Expected Ruby version > 1.8.3, was 1.8.1

Oops, we’ll need a newer version of ruby, by default CentOS 4 comes with ruby 1.8.1 . To install a newer version of ruby we’ll subscribe to testing repository from CentOS. To do this we’ll create a repo file called CentOS-Testing.repo in /etc/yum.repos.d directory:

CentOS-Testing.repo content

# /etc/yum.repos.d/CentOS-Testing.repo
# packages in testing repository
[testing]
name=CentOS-$releasever - Testing
baseurl=http://dev.centos.org/centos/$releasever/testing/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing

Note the line with enabled=0, we’ll enable the repository only when needed. Install ruby from the testing repository:

[root@monster ~]# yum --enablerepo=testing install ruby ruby-devel ruby-libs ruby-irb ruby-rdoc 
Loading "fastestmirror" plugin
Setting up Install Process
Setting up repositories
Loading mirror speeds from cached hostfile
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
...
Dependencies Resolved
 
=============================================================================
 Package                 Arch       Version          Repository        Size 
=============================================================================
Installing:
 ruby-irb                i386       1.8.5-5.el4.centos.1  testing            67 k
 ruby-rdoc               i386       1.8.5-5.el4.centos.1  testing           132 k
Updating:
 ruby                    i386       1.8.5-5.el4.centos.1  testing           272 k
 ruby-devel              i386       1.8.5-5.el4.centos.1  testing           503 k
 ruby-libs               i386       1.8.5-5.el4.centos.1  testing           1.5 M
 
Transaction Summary
=============================================================================
Install      2 Package(s)         
Update       3 Package(s)         
Remove       0 Package(s)         
Total download size: 2.5 M
Is this ok [y/N]: y
Downloading Packages:
(1/5): ruby-rdoc-1.8.5-5. 100% |=========================| 132 kB    00:02     
(2/5): ruby-libs-1.8.5-5. 100% |=========================| 1.5 MB    00:14     
(3/5): ruby-devel-1.8.5-5 100% |=========================| 503 kB    00:04     
(4/5): ruby-1.8.5-5.el4.c 100% |=========================| 272 kB    00:03     
(5/5): ruby-irb-1.8.5-5.e 100% |=========================|  67 kB    00:01     
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating  : ruby-libs                    ######################### [1/9] 
  Updating  : ruby                         ######################### [2/9] 
  Installing: ruby-irb                     ######################### [3/9] 
  Installing: ruby-rdoc                    ######################### [4/9] 
  Updating  : ruby-devel                   ######################### [5/9] 
  Cleanup   : ruby-libs                    ######################### [6/9]
  Cleanup   : ruby-devel                   ######################### [7/9]
  Cleanup   : ruby                         ######################### [8/9]
  Removing  : irb                          ######################### [9/9]
 
Installed: ruby-irb.i386 0:1.8.5-5.el4.centos.1 ruby-rdoc.i386 0:1.8.5-5.el4.centos.1
Updated: ruby.i386 0:1.8.5-5.el4.centos.1 ruby-devel.i386 0:1.8.5-5.el4.centos.1 ruby-libs.i386 0:1.8.5-5.el4.centos.1
Complete!

Now it’s better, we do have ruby 1.8.5 installed on the system. Let’s return to RubyGems install:

[root@monster rubygems-1.2.0]# ruby setup.rb
...
------------------------------------------------------------------------------
 
RubyGems installed the following executables:
        /usr/bin/gem
 
If `gem` was installed by a previous RubyGems installation, you may need
to remove it by hand.

Voila! We have installed RubyGems 1.2 on the CentOS 4 server.
twitter最近将ruby实现的消息队列服务器starling开源了,这是一个支持memcache协议的轻量级持久化服务器,因此使用php/perl/ruby/java等多种客户端都没问题,可以将较慢的处理逻辑通过消息队列放在后台处理,同时也支持多点分布式处理。周末找了个闲置的centos 5机器搭了一套starling试用,配合php的memcache扩展测试一番,有点意思。
starling安装步骤

centos默认不带ruby,得重新装,以下安装步骤都是以root身份跑的。

yum install ruby ruby-devel rubygems
gem install memcache-client starling

如果你使用yum找不到ruby的相关包,请记得添加epel repository。安装之后新增的程序:

    /usr/bin/starling #一个ruby脚本,starling的服务程序
    /usr/bin/starling_top #starling的状态检查程序,可以查看starling的运行状态,类似memcache的状态显示,不同的是能够显示每个key的状态

starling启动后默认会在22122端口蹲点守候。

为了使用方便,我修改了一个starling在centos下的启动脚本,放在/etc/init.d/starling,下载地址:http://customcode.googlecode.com/files/starling。使用方法:

/etc/init.d/starling start|stop|restart



源文件目录


在使用CentOS系统的时候,我们可能会遇到安装ruby 的问题,下面,我们就来针对这个问题,提出一个解决方案。

CentOS系统中首先下载ruby

Ruby代码

 

  ftp://ftp.ruby-lang.org/pub/ruby/1.8/
  http://rubyforge.org/frs/?group_id=126&release_id=46643
wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p368.tar.gz  
wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p368.tar.gz

Ruby代码
tar xzvf ruby-1.8.6-p368.tar.gz  
tar xzvf ruby-1.8.6-p368.tar.gz

然后进到ruby-1.8.6-p368目录

CentOS系统执行Ruby代码 
./config -prefix=/usr/local/ruby  
./config -prefix=/usr/local/ruby

开发编译安装

Ruby代码
make && make install  
make && make install

CentOS系统中再配置环境变量使在全局可用:

在/etc/profile后加入

Ruby代码
export PATH=/usr/local/ruby/bin:$PATH  
export PATH=/usr/local/ruby/bin:$PATH

保存后,su -

ruby -v 看能否正常使用。

CentOS系统下面安装rubygem

Ruby代码
wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz  
wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz

解压后,进入目录,执行 ruby setup.rb 进行安装。

安装过后更新 gem

Ruby代码 
gem update --system   
gem update 

这样,我们就在CentOS系统安装ruby环境完成了。


分享到:
评论
2 楼 vanadiumlin 2012-11-20  
i_feng 写道
现在在windows环境下有什么解决方案呢,starling怎么安装,上面的一些包都有点旧

starling 已经不更新了,有bug~    建议换Kestrel,还是队列服务器一般都在linux下部署比较好~
1 楼 i_feng 2012-11-13  
现在在windows环境下有什么解决方案呢,starling怎么安装,上面的一些包都有点旧

相关推荐

Global site tag (gtag.js) - Google Analytics