繁体   English   中英

为Cassandra安装PHP驱动程序

[英]Installing PHP driver for Cassandra

我在linode上创建服务器并安装了Ubuntu 15.10,并在控制台中输入安装php的命令

apt-get update
apt-get install -y php5
sudo apt-get install php5-dev

然后,我安装了软件:boost,openssl,libtool和cmake

sudo apt-get install libboost-all-dev
sudo apt-get install openssl
apt-get install cmake

sudo apt-get install automake libtool curl
curl -sSL https://github.com/libuv/libuv/archive/v1.4.2.tar.gz | sudo tar zxfv - -C /usr/local/src
cd /usr/local/src/libuv-1.4.2
sudo sh autogen.sh
sudo ./configure
sudo make 
sudo make install
sudo rm -rf /usr/local/src/libuv-1.4.2 && cd ~/
sudo ldconfig
sudo apt-get install libssl-dev

然后,我安装了cassnadra use datastax文档

echo "deb http://debian.datastax.com/community stable main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
curl -L http://debian.datastax.com/debian/repo_key | sudo apt-key add -
sudo apt-get update
sudo apt-get install dsc20=2.0.11-1 cassandra=2.0.11

我检查了卡斯纳德拉

sudo service cassandra status

我明白了:

● cassandra.service - LSB: distributed storage system for structured data
   Loaded: loaded (/etc/init.d/cassandra)
   Active: active (running) since Mon 2016-02-08 09:12:59 EST; 21s ago
     Docs: man:systemd-sysv-generator(8)
   CGroup: /system.slice/cassandra.service
           └─27880 java -ea -javaagent:/usr/share/cassandra/lib/jamm-0.2.5.jar -XX:+CMSClassUnloadingEnabled -XX:+UseThreadPriorities -XX:Threa...

Feb 08 09:12:59 ubuntu systemd[1]: Starting LSB: distributed storage system for structured data...
Feb 08 09:12:59 ubuntu systemd[1]: Started LSB: distributed storage system for structured data.

我检查集群和cqlsh的状态:

sudo nodetool status

并得到:

Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load       Tokens  Owns (effective)  Host ID                               Rack
UN  127.0.0.1  41.32 KB   256     100.0%            2eaa4bd9-136d-4c2a-a65e-7444eb9d8824  rack1

和:

Connected to Test Cluster at localhost:9160.
[cqlsh 4.1.1 | Cassandra 2.0.11 | CQL spec 3.1.1 | Thrift protocol 19.39.0]
Use HELP for help.

一切正常! 最后,我尝试为Cassandra安装PHP驱动程序,方法如下:

git clone https://github.com/datastax/cpp-driver.git
cd cpp-driver
cmake . && make && make install
ln -s libcql.so.0.7.0 /usr/lib/libcql.so.0
ln -s /usr/lib/libcql.so.0 /usr/lib/libcql.so
git clone https://github.com/aparkhomenko/php-cassandra.git
cd php-cassandra
phpize && ./configure && make

但是我得到了错误

checking for specified location of CQL library... yes, shared
checking for CQL in default path... not found
configure: error: Please reinstall the cassandra distribution

我的错误在哪里?

我认为问题在于您正在安装Cassandra的C / C ++驱动程序:

git clone https://github.com/datastax/ cpp-driver .git

相反,您必须使用PHP之一:

git clone https://github.com/datastax/php-driver.git
cd php-driver
git submodule update --init
cd ext
./install.sh

然后,在php.ini中添加扩展名。 对于apache2:

echo -e "; DataStax PHP Driver\nextension=cassandra.so" >> /etc/php5/cli/php.ini
echo -e "; DataStax PHP Driver\nextension=cassandra.so" >> /etc/php5/apache2/php.ini

/etc/init.d/apache2 reload

您在此之前所做的一切都还可以。

来源: https : //github.com/datastax/php-driver/blob/master/ext/README.md

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM