Skip to content

Instantly share code, notes, and snippets.

@boogie
Last active August 29, 2015 14:24
Show Gist options
  • Save boogie/89d5d31577ea9529e6bf to your computer and use it in GitHub Desktop.
Save boogie/89d5d31577ea9529e6bf to your computer and use it in GitHub Desktop.
CentOS 6.4 - Zookeeper PHP extension
mkdir zookeeper
cd zookeeper
curl -O https://cloud.github.com/downloads/globocom/zookeeper-centos-6/libzookeeper-3.4.3-2.x86_64.rpm
curl -O https://cloud.github.com/downloads/globocom/zookeeper-centos-6/libzookeeper-devel-3.4.3-2.x86_64.rpm
sudo rpm -ivh libzookeeper-3.4.3-2.x86_64.rpm
sudo rpm -ivh libzookeeper-devel-3.4.3-2.x86_64.rpm
sudo yum install git
sudo yum install gcc gcc-c++ kernel-devel
sudo yum install php-devel
git clone https://github.com/andreiz/php-zookeeper.git
cd php-zookeeper
pear build
./configure
make
make install
# add "extension=zookeeper.so" to /etc/php.ini
{
"require": {
"nmred/kafka-php": "0.1.2"
}
}
curl -sS https://getcomposer.org/installer | php
php composer.phar install
<?php
require 'vendor/autoload.php';
$produce = \Kafka\Produce::getInstance('172.16.25.113:2181', 3000);
while (1==1) {
$produce->setRequireAck(-1);
$produce->setMessages('test', 0, array('Hello World!' . rand(0, 10000)));
$result = $produce->send();
var_dump($result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment