Не удается подключиться к Cassandra на облачном сервере с помощью phpcassa

Я настроил тестовый облачный сервер (Ubuntu 10.10 на Rackspace) для работы с базой данных Cassandra (0.6.8). Я могу без проблем подключиться как изнутри сервера, так и с компьютера, внешнего по отношению к облаку, с помощью базового клиента cassandra-cli: я создал и получил образцы данных.

Затем я установил phpcassa на облачный сервер и на внешний компьютер.

Я создал очень простую программу php для проверки соединения:

<?php
$GLOBALS['THRIFT_ROOT'] = dirname(__FILE__) . '/include/thrift/';
require_once $GLOBALS['THRIFT_ROOT'].'/packages/cassandra/Cassandra.php';
require_once $GLOBALS['THRIFT_ROOT'].'/transport/TSocket.php';
require_once $GLOBALS['THRIFT_ROOT'].'/protocol/TBinaryProtocol.php';
require_once $GLOBALS['THRIFT_ROOT'].'/transport/TFramedTransport.php';
require_once $GLOBALS['THRIFT_ROOT'].'/transport/TBufferedTransport.php';

include_once(dirname(__FILE__) . '/include/phpcassa.php');
include_once(dirname(__FILE__) . '/include/uuid.php');

echo 'phpcassa test01<br /><br />';
CassandraConn::add_node('184.106.97.245', 9160);

$users = new CassandraCF('Keyspace1', 'Standard2');

try {
    $res = $users->get('jsmith');
    print_r($res);
} catch (Exception $e) {
    print CassandraConn::$last_error;
}

echo 'End.'
?>

Я использую буферизованный транспорт.

Я могу с радостью подключиться и прочитать данные с сервера (я также установил на него LAMP):

phpcassa test01
Array ( [age] => 42 [first] => John [last] => Smith ) 
End.

но не извне, потому что я всегда получаю исключение:

phpcassa test01
TException: TSocket: Could not connect to 184.106.97.245:9160 (Operation timed out [60])
End.

Это мой файл storage-conf.xml:

<Storage>
<ClusterName>Test Cluster</ClusterName>
<AutoBootstrap>false</AutoBootstrap>
<HintedHandoffEnabled>true</HintedHandoffEnabled>
<IndexInterval>128</IndexInterval>
<Keyspaces>
<Keyspace Name="Keyspace1">
  <ColumnFamily Name="Standard1" CompareWith="BytesType"
                KeysCached="1000"
                RowsCached="100"
                RowCacheSavePeriodInSeconds="0"
                KeyCacheSavePeriodInSeconds="3600"/>
  <ColumnFamily Name="Standard2" 
                CompareWith="UTF8Type"
                KeysCached="100%"/>
  <ColumnFamily Name="StandardByUUID1" CompareWith="TimeUUIDType" />
  <ColumnFamily Name="Super1"
                ColumnType="Super"
                CompareWith="BytesType"
                CompareSubcolumnsWith="BytesType" />
  <ColumnFamily Name="Super2"
                ColumnType="Super"
                CompareWith="UTF8Type"
                CompareSubcolumnsWith="UTF8Type"
                RowsCached="10000"
                KeysCached="50%"
                Comment="A column family with supercolumns, whose column and subcolumn names are UTF8 strings"/>
  <ReplicaPlacementStrategy>org.apache.cassandra.locator.RackUnawareStrategy</ReplicaPlacementStrategy>
  <ReplicationFactor>1</ReplicationFactor>
  <EndPointSnitch>org.apache.cassandra.locator.EndPointSnitch</EndPointSnitch>        
</Keyspace>
</Keyspaces>
<Authenticator>org.apache.cassandra.auth.AllowAllAuthenticator</Authenticator>  
<Partitioner>org.apache.cassandra.dht.RandomPartitioner</Partitioner>
<InitialToken></InitialToken>
<SavedCachesDirectory>/var/lib/cassandra/saved_caches</SavedCachesDirectory>
<CommitLogDirectory>/var/lib/cassandra/commitlog</CommitLogDirectory>
<DataFileDirectories>
  <DataFileDirectory>/var/lib/cassandra/data</DataFileDirectory>
</DataFileDirectories>
<Seeds>
  <Seed>184.106.97.245</Seed>
</Seeds>
<RpcTimeoutInMillis>10000</RpcTimeoutInMillis>
<CommitLogRotationThresholdInMB>128</CommitLogRotationThresholdInMB>
<ListenAddress>184.106.97.245</ListenAddress>
<StoragePort>7000</StoragePort>
<ThriftAddress>184.106.97.245</ThriftAddress>
<ThriftPort>9160</ThriftPort>
<ThriftFramedTransport>false</ThriftFramedTransport>
<DiskAccessMode>auto</DiskAccessMode>
<RowWarningThresholdInMB>64</RowWarningThresholdInMB>
<SlicedBufferSizeInKB>64</SlicedBufferSizeInKB>
<FlushDataBufferSizeInMB>32</FlushDataBufferSizeInMB>
<FlushIndexBufferSizeInMB>8</FlushIndexBufferSizeInMB>
<ColumnIndexSizeInKB>64</ColumnIndexSizeInKB>
<MemtableThroughputInMB>64</MemtableThroughputInMB>
<BinaryMemtableThroughputInMB>256</BinaryMemtableThroughputInMB>
<MemtableOperationsInMillions>0.3</MemtableOperationsInMillions>
<MemtableFlushAfterMinutes>60</MemtableFlushAfterMinutes>
<ConcurrentReads>8</ConcurrentReads>
<ConcurrentWrites>32</ConcurrentWrites>
<CommitLogSync>periodic</CommitLogSync>
<CommitLogSyncPeriodInMS>10000</CommitLogSyncPeriodInMS>
<GCGraceSeconds>864000</GCGraceSeconds>
<DoConsistencyChecksBoolean>true</DoConsistencyChecksBoolean>
</Storage>

Служба поддержки Rackspace предложила изменить настройки брандмауэра, но у меня нет брандмауэра:

root@Oahu:~# iptables --list
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Любая помощь очень ценится!!!

Привет, Руджеро


person Rujero Domenichini    schedule 10.01.2011    source источник
comment
На что похожа ваша внешняя машина? ОС, версия php и т.д. Вывод iptables с сервера или с внешнего клиента?   -  person Tyler Hobbs    schedule 11.01.2011
comment
У меня та же проблема, на обеих машинах CentOS 5, PHP 5.3. Вывод iptables в моем случае такой же, как и выше на обеих машинах. Я использую последнюю версию библиотеки phpcassa @Tyler Hobbs.   -  person dmcnelis    schedule 02.03.2011
comment
dmcnelis: Вы используете Cassandra 0.7.x?   -  person Tyler Hobbs    schedule 07.03.2011


Ответы (1)


Получите доступ к узлу (сначала) с помощью http://wiki.apache.org/cassandra/CassandraCli.

person Writecoder    schedule 23.11.2011