首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >暂停直到重新启动

暂停直到重新启动
EN

Stack Overflow用户
提问于 2013-10-29 11:45:58
回答 1查看 282关注 0票数 1

我建立了一个带有两个节点的cassandra集群。在写了几千次之后,它开始抛出TimeOut异常,这些异常直到我重新启动cassandra服务之后才会消失。我正在使用phpcassa (最迟在撰写本文时)。

Cassandra.yaml双

  • cluster_name:“测试集群”
  • seed_provider:
    • org.apache.cassandra.locator.SimpleSeedProvider :class_name

  • 参数:
    • 种子:"192.168.2.101“

  • rpc_address: 0.0.0.0
  • rpc_port: 8080

Cassandra.yaml 1

  • initial_token: 0
  • listen_address: 192.168.2.101

Cassandra.yaml 2

  • initial_token: 85070591730234615865843651857942052864
  • listen_address: 192.168.2.102

假设这个配置是正确的,我的代码肯定有问题。下面是我为再现错误而制作的测试脚本:

代码语言:javascript
运行
复制
$pool = Config::ConnectionPool();
$stressTest = new ColumnFamily($pool, 'TwitterTest');
$id = 392766928478932992;

while(true)
{
    try
    {
        $stressTest->insert($id++, array("analyzed"=>0, "followersCount"=>"35",
            "friendsCount"=>"30", "lang"=>"en", "listedCount"=>"0",
            "name"=>"Henky Tanky", "statusesCount"=>"X", "text"=>"@HERPDERP dude i kno i lost a 16gb flash drive #MEH",
            "time"=>"2013-10-22 23:38:27", "twitterId"=>"392766928478932992", "username"=>"mehzor"),
            null, null, \cassandra\ConsistencyLevel::ANY);
    }
    catch (Exception $ex){
        print_r($ex);
        exit;
    }
}

class Config {
    static function ConnectionPool(){
        return new ConnectionPool('KSTwit', array('192.168.2.101:8080', '192.168.2.102:8080'));
    }
}

使用这个配置,我会得到一个'cassandra\TimedOutException‘(Stacktrace 1)

代码语言:javascript
运行
复制
// Set max-retries to 5, and read/write timeout to 60 seconds
new ConnectionPool('KSTwit', array('192.168.2.101:8080', '192.168.2.102:8080'), NULL, 5, 60000, 60000);

使用该配置,我将得到一个‘TTransportException\TTransportException’(Stacktrace 2)。

我尝试过各种ConsistencyLevels;一种,法定人数和任何一种。他们都有同样的问题。

就像我说过的,例外情况要经过几次写作之后才会发生。但是,如果在出现异常后重新启动脚本,它将立即抛出异常。我必须重新启动卡桑德拉的服务,然后它可能需要两千次。这似乎只发生在写。如果我不使用计数器列,也会发生这种情况,所以这不是问题。

堆栈跟踪1

代码语言:javascript
运行
复制
Error performing add on 192.168.2.101:8080: exception 'cassandra\TimedOutException' in /var/installstuff/cassphp/lib/Thrift/Base/TBase.php:206
Stack trace:
#0 /var/installstuff/cassphp/lib/cassandra/Cassandra.php(3575): Thrift\Base\TBase->_read('Cassandra_add_r...', Array, Object(Thrift\Protocol\TBinaryProtocolAccelerated))
#1 /var/installstuff/cassphp/lib/cassandra/Cassandra.php(768): cassandra\Cassandra_add_result->read(Object(Thrift\Protocol\TBinaryProtocolAccelerated))
#2 /var/installstuff/cassphp/lib/cassandra/Cassandra.php(728): cassandra\CassandraClient->recv_add()
#3 [internal function]: cassandra\CassandraClient->add('All Tweets', Object(cassandra\ColumnParent), Object(cassandra\CounterColumn), 1)
#4 /var/installstuff/cassphp/lib/phpcassa/Connection/ConnectionPool.php(264): call_user_func_array(Array, Array)
#5 /var/installstuff/cassphp/lib/phpcassa/ColumnFamily.php(44): phpcassa\Connection\ConnectionPool->call('add', 'All Tweets', Object(cassandra\ColumnParent), Object(cassandra\CounterColumn), 1)
#6 /var/installstuff/cassphp/examples/db/TweetDatabase.php(103): phpcassa\ColumnFamily->add('All Tweets', 'Total')
#7 /var/installstuff/cassphp/examples/core/Helper.php(16): {closure}()
#8 /var/installstuff/cassphp/examples/db/TweetDatabase.php(104): Helper::DoForgiving(Object(Closure))
#9 /var/installstuff/cassphp/examples/core/twitterParser.php(98): TweetDatabaseCassandra->AddTweet('392633738364190...', Array)
#10 /var/installstuff/cassphp/examples/core/twitterParser.php(192): TwitterParser->RunOnce()
#11 /var/installstuff/cassphp/examples/runners/twitterParserCassandra.php(19): TwitterParser->Run()
#12 {main}

堆栈跟踪2

代码语言:javascript
运行
复制
Error performing add on 192.168.2.101:8080: exception 'Thrift\Exception\TTransportException' with message 'TSocket: timed out reading 4 bytes from 192.168.2.101:8080' in /var/installstuff/cassphp/lib/Thrift/Transport/TSocket.php:284
Stack trace:
#0 /var/installstuff/cassphp/lib/Thrift/Transport/TTransport.php(74): Thrift\Transport\TSocket->read(4)
#1 /var/installstuff/cassphp/lib/Thrift/Transport/TFramedTransport.php(139): Thrift\Transport\TTransport->readAll(4)
#2 /var/installstuff/cassphp/lib/Thrift/Transport/TFramedTransport.php(106): Thrift\Transport\TFramedTransport->readFrame()
#3 /var/installstuff/cassphp/lib/Thrift/Transport/TTransport.php(74): Thrift\Transport\TFramedTransport->read(4)
#4 /var/installstuff/cassphp/lib/Thrift/Protocol/TBinaryProtocol.php(305): Thrift\Transport\TTransport->readAll(4)
#5 /var/installstuff/cassphp/lib/Thrift/Protocol/TBinaryProtocol.php(197): Thrift\Protocol\TBinaryProtocol->readI32(NULL)
#6 /var/installstuff/cassphp/lib/cassandra/Cassandra.php(760): Thrift\Protocol\TBinaryProtocol->readMessageBegin(NULL, 0, 0)
#7 /var/installstuff/cassphp/lib/cassandra/Cassandra.php(728): cassandra\CassandraClient->recv_add()
#8 [internal function]: cassandra\CassandraClient->add('All Tweets', Object(cassandra\ColumnParent), Object(cassandra\CounterColumn), 1)
#9 /var/installstuff/cassphp/lib/phpcassa/Connection/ConnectionPool.php(264): call_user_func_array(Array, Array)
#10 /var/installstuff/cassphp/lib/phpcassa/ColumnFamily.php(44): phpcassa\Connection\ConnectionPool->call('add', 'All Tweets', Object(cassandra\ColumnParent), Object(cassandra\CounterColumn), 1)
#11 /var/installstuff/cassphp/examples/db/TweetDatabase.php(103): phpcassa\ColumnFamily->add('All Tweets', 'Total')
#12 /var/installstuff/cassphp/examples/core/Helper.php(17): {closure}()
#13 /var/installstuff/cassphp/examples/db/TweetDatabase.php(104): Helper::DoForgiving(Object(Closure))
#14 /var/installstuff/cassphp/examples/core/twitterParser.php(98): TweetDatabaseCassandra->AddTweet('392642135327264...', Array)
#15 /var/installstuff/cassphp/examples/core/twitterParser.php(192): TwitterParser->RunOnce()
#16 /var/installstuff/cassphp/examples/runners/twitterParserCassandra.php(19): TwitterParser->Run()
#17 {main}

卡桑德拉的日志并没有显示出任何有趣的东西。除了这引起了很多麻烦,但即使例外情况不发生,也会发生,所以我不认为这是问题所在;

代码语言:javascript
运行
复制
INFO 10:58:58,241 Timed out replaying hints to /192.168.2.102; aborting further deliveries
WARN 11:07:17,979 MemoryMeter uninitialized (jamm not specified as java agent); assuming liveRatio of 10.0.  Usually this means cassandra-env.sh disabled jamm because you are using a buggy JRE; upgrade to the Sun JRE instead

键空间是使用‘SIMPLE_STRATEGY’和‘replication_factor=2’设置的,根据这两台机器上的‘nodetool’命令,即使触发了异常,节点仍在正常工作。老实说,我不知道下一步该做什么,有人能发现这个问题吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-11-06 09:33:45

我用两种方法之一解决了这个问题(不能肯定)。

我最初使用在线指南安装了cassandra,上面列出了这些回购产品;

代码语言:javascript
运行
复制
deb http://www.apache.org/dist/cassandra/debian 11x main
deb-src http://www.apache.org/dist/cassandra/debian 11x main

这些都过时了,有一个20x版本,所以我更新了这个版本。

我还用sun的java代替了jsvc。现在一切都很顺利。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19657360

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档