2016-02-08 332 views
0

安裝PHP驅動程序我創建的Linode服務器並安裝了Ubuntu 15.10和我的控制檯,輸入命令安裝PHP的卡桑德拉

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

然後,我安裝的軟件:升壓,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使用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 

我車cked cassnadra

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. 

一切正常!最後我嘗試安裝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 

哪裏是我的錯?

回答

1

我覺得現在的問題是,你的C/C++安裝Cassandra的驅動程序:

混帳克隆https://github.com/datastax/CPP-驅動 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

現在
+0

我如何繼續..給看看我的帖子 - http://stackoverflow.com/questions/36537775/php-driver-datastax-cassandra-db-how-to-使用 –

+0

嘗試執行此操作: ** echo -e「; DataStax PHP驅動程序\ nextension = cassandra.so」>> /etc/php/7.0/fpm/php.ini** – Kalu