dsegw3424 2017-08-11 09:41
浏览 210

在使用DCAwareRoundRobinPolicy时,还请阅读在远程主机上搜索

I am using DCAwareRoundRobinPolicy for my cassandra connection. But the time taken for querying by my driver is comparatively larger than when i am using the same connection parameters in php.

The datastax driver in php uses the function to the the same:

withDatacenterAwareRoundRobinLoadBalancingPolicy(
   string $localDatacenter, int $hostPerRemoteDatacenter, 
   bool $useRemoteDatacenterForLocalConsistencies )

When the last parameter is set as false, only local hosts are used for querying. But this parameter setting is not available in gocql driver. And I am guessing that this may be causing the issue I am facing. Correct me if I am wrong.

Please help in this regard what can be done.

I was not facing this issue when I had only 1 node in cluster.

For nodetool status :

Datacenter: DC1

Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns Host ID Rack
UN 206.* 298.89 GB 1 ? de58dea3-7d16-4318-8549-a34d42aa3d65 RAC1
UN 206.* 287.63 GB 1 ? b312ce3d-c23f-476e-9396-3f8ec2219425 RAC1
UN 206.* 280.08 GB 1 ? c82f1f90-bca6-4438-bc43-68bf370a555a RAC1
UN 206.* 260.61 GB 1 ? 95b33f1f-d282-42ea-974b-987552932535 RAC1
UN 206.* 301.05 GB 1 ? 4725e34f-9368-4c18-85ef-6cd96352b73e RAC1

Datacenter: DC3

Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns Host ID Rack
UN 173.* 262.16 GB 256 ? 283afa18-d085-4ff0-b410-e0f5fd368669 RAC1
UN 173.* 292.17 GB 256 ? b59a0d6c-2f77-4912-a0ad-eae3687aabbc RAC1
UN 173.* 253.07 GB 256 ? 44b6e01a-f6f1-471c-95a2-ff66f6188438 RAC1
UN 173.* 281.6 GB 256 ? 43d1a656-5aeb-42a9-bfee-c11f1a0a76dc RAC1
UN 173.* 250.6 GB 256 ? ceb40080-012c-4446-8a6b-220ffa472ddc RAC1
  • 写回答

1条回答 默认 最新

  • dra11767 2018-10-29 05:37
    关注

    I was having similar issue, but by forcing nodes from local DC to contact on LOCAL DC nodes; I was able to fix this for me.

    You can force nodes to contact local DC nodes first by setting the the localDC to name of localDC & add the contact points also from local DC.

    DCAwareRoundRobinPolicy.builder().withLocalDc(getLocalDC());
    
    StringTokenizer tokenizer = new StringTokenizer(getCassandraHostsOfLocalDC().trim(),",");
    while(tokenizer.hasMoreElements()){
        contactPoints.add(tokenizer.nextToken().trim());
    }
    builder.addContactPoints(contactPoints.toArray(new String[0]));
    
    评论

报告相同问题?

悬赏问题

  • ¥15 init i2c:2 freq:100000[MAIXPY]: find ov2640[MAIXPY]: find ov sensor是main文件哪里有问题吗
  • ¥15 运动想象脑电信号数据集.vhdr
  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景