Gearman Install OSX
安裝Gearman 在OSX上面
$ sudo -s
$ cd /tmp
$ wget https://github.com/downloads/libevent/libevent/libevent-2.0.15-stable.tar.gz
$ tar zxvf libevent-2.0.15-stable.tar.gz
$ cd libevent-2.0.15-stable
$ ./configure
$ make
$ make install
$ cd ..
$ wget https://launchpad.net/ubuntu/lucid/+source/libdrizzle/0.7-1/+files/libdrizzle_0.7.orig.tar.gz
$ tar libdrizzle_0.7.orig.tar.gz
$ cd libdrizzle-0.7/
$ ./configure
$ make
$ make install
$ cd ..
$ wget http://launchpad.net/gearmand/trunk/0.14/+download/gearmand-0.14.tar.gz
$ tar zxvf gearmand-0.14.tar.gz
$ cd gearmand-0.14/
$ ./configure
$ make
$ make install
$ cd ..
$ wget http://pecl.php.net/get/gearman-0.8.0.tgz
$ tar zxvf gearman-0.8.0.tgz
$ cd gearman-0.8.0
$ phpize
$ ./configure
$ make
$ sudo make install
/bin/sh /tmp/gearman-0.8.0/libtool --mode=install cp ./gearman.la /tmp/gearman-0.8.0/modules
cp ./.libs/gearman.so /tmp/gearman-0.8.0/modules/gearman.so
cp ./.libs/gearman.lai /tmp/gearman-0.8.0/modules/gearman.la
----------------------------------------------------------------------
Libraries have been installed in:
/tmp/gearman-0.8.0/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable
during execution
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20090626/
$ which php
/usr/bin/php
$ php --info | grep -i configuration (11-17 13:30)
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /private/etc/php.ini
Configuration
$ vi /private/etc/php.ini
======= 加入以下資訊 ======
extension_dir = " /usr/lib/php/extensions/no-debug-non-zts-20090626/" <~~這不一定要
extension="gearman.so"
========================
$ php --info | egrep -i "(configuration|gearman)"
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /private/etc/php.ini
Configuration
gearman
gearman support => enabled
libgearman version => 0.14
Gearman Install on Ubuntu
gearman 在ubuntu 上不知哪個版本已無提供libdrizzlea模組.
導致要使用myql作為資料源已無法使用.
以下是自行編譯安裝方式:
Git 與遠端Server 應用
乘上篇文章gitolite 安裝.
當你開心使用git一陣子,又在網路上免費或付費支援git平台的版本控管後是否發覺….
真的好麻煩每次都要同步好幾台SERVER上面的repositories…
有沒有在push上server後自動幫你搞定呢?!
gitolite 安裝
FreeBSD gitolite 安裝
安裝:
# cd /usr/ports/devel/gitolite ; make install clean;
安裝結束最後面會看到以下提示:
==============================================================================
Final gitolite installation instructions:
Any ssh user can be a gitolite provider. Simply run the following command as
the user:
/usr/local/bin/gl-setup /path/to/admin.ssh.key.pub
This will setup up the configuration files for gitolite, designating where the
repositories are located and other options.
The admin ssh key allows full access to the gitolite-admin repository where
additional users and repositories can be configured.
By default, the git user is created for use by gitolite.
==============================================================================
===> Correct pkg-plist sequence to create group(s) and user(s)
===> Registering installation for gitolite-2.1
===> Cleaning for gitolite-2.1
MongoDB Sharing
MongoDB Sharing[
可以先看看官網介紹:Sharding Introduction
Shards 類似 Mysql 的Data nodes.
Config Servers 類似 Mysql 的Management node.
Routing Processes 類似 Mysql 的SQL node.
MongoDB VS Mysql 簡單測試.
廢話不多說.
MongoDB 使用 MongoDB Object Document Mapper測試.
Mysql 使用 Object Relational Mapper測試.
MongoDB部分:
config.php
register();
$classLoader = new ClassLoader('Doctrine\ODM\MongoDB', __DIR__ . '/../../lib');
$classLoader->register();
$classLoader = new ClassLoader('Doctrine\MongoDB', __DIR__ . '/../../lib/vendor/doctrine-mongodb/lib');
$classLoader->register();
$classLoader = new ClassLoader('Symfony', __DIR__ . '/../../lib/vendor');
$classLoader->register();
$classLoader = new ClassLoader('Documents', __DIR__);
$classLoader->register();
$config = new Configuration();
$config->setProxyDir(__DIR__ . '/Proxies');
$config->setProxyNamespace('Proxies');
$config->setHydratorDir(__DIR__ . '/Hydrators');
$config->setHydratorNamespace('Hydrators');
$config->setDefaultDB('doctrine_odm_sandbox');
//使用safe模式
$con = new Connection('localhost',array('safe'=>true, 'w' => 2,'wtimeoutMS' => 2000));
//使用一般模式
//$con = new Connection('localhost');
$reader = new AnnotationReader();
$reader->setDefaultAnnotationNamespace('Doctrine\ODM\MongoDB\Mapping\\');
$config->setMetadataDriverImpl(new AnnotationDriver($reader, __DIR__ . '/Documents'));
$dm = DocumentManager::create($con, $config);
Lua for PHP 實測
繼上一篇 Lua for PHP 安裝,現在來是實測Lua 速度.
素聞Lua 執行效能速度之優異不論是陣列字串運算處理皆在PHP之上,這篇先主要針對Array做實測.
index.php
array_b = $array_b;
//測試PHP物件排序效能
$mtime = explode(' ', microtime());
$starttime = $mtime[1] + $mtime[0];
//var_dump($array_a);
rsort($array_a);
//var_dump($array_a);
$mtime = explode(' ', microtime());
$times=number_format(($mtime[1] + $mtime[0] - $starttime), 8);
//顯示PHP執行結果所需時間
echo "PHP rsort time $times \n";
$mtime = explode(' ', microtime());
$starttime = $mtime[1] + $mtime[0];
//var_dump($array_b);
//測試Lua物件排序效能
$array_b = $lua->test();
//var_dump($array_b);
$mtime = explode(' ', microtime());
$times=number_format(($mtime[1] + $mtime[0] - $starttime), 8);
//顯示Lua執行結果所需時間
echo "Lua array sort time $times \n";
test.lua
function test()
table.sort( array_b )
return array_b
end
Lua for Windows 開發 筆記
下載:Lua 5.2.0-work2 – Release 1
先參考此篇教學Using Lua with C#並去 LuaInterface 下載回來,看了一下注意事項好像必須 Microsoft Visual C++ 2008 可轉散發套件 (x86) 一併下載回來比較保險.
後來找到 luaforwindows Windows底下Lua整合套件.
MongoDB 新手入門筆記~
Linux 安裝:
$ apt-get install mongodb-server mongodb-dev
$ sudo pecl install mongo
編輯php設定檔 加入 extension=mongo.so
php -m 即可以看到安裝好的擴充套件.
FreeBSD 安裝:
$ cd /usr/ports/databases/mongodb ; make install clean ;
$ cd /usr/ports/databases/pecl-mongo ; make install clean ;
php -m 即可以看到安裝好的擴充套件.
編輯/etc/rc.conf:
Lua for PHP 安裝
主要安裝擴充套件資訊 LUA for PHP
使用 Plua 為安裝源.
Linux 安裝方式:
先安裝好 lua:
$apt-get install lua5.1 liblua5.1-0-dev
先下載並解開:
$ cd /tmp
$ wget http://plua.googlecode.com/files/plua-1.0.0.zip
$ tar zxvf plua-1.0.0.zip
$ cd plua
$ phpize
$ whereis php-config
php-config: /usr/bin/php-config /usr/share/man/man1/php-config.1.gz
$ rm -f include
$ ln -s /usr/include/lua5.1 include
$ ln -s /usr/lib lib
$ cd lib
$ ln -s /usr/lib/liblua5.1.a liblua.a
$ ln -s /usr/lib/liblua5.1.so liblua.so
$ cd ..
$ make
$ make install
Installing shared extensions: /usr/lib/php5/20090626/
$
自行編輯php 設定 增加extension=plua.so