2017-10-23 2 views
0

아파치 지오 코딩을 사용하여 매우 큰 값을 복제하려고합니다. 내가 기본적으로하고있는 것은 redis의 setbit 함수를 사용하는 것이다. setbit 함수에 대한 오프셋을 계속 늘리면 지오 데이 서버가 충돌합니다. 클라이언트로 geode의 redis 어댑터를 사용하고 있습니다.아파치 지오 코드 복제로 큰 값을 복제 할 수 없습니다.

import redis.clients.jedis.*; 
import redis.clients.jedis.exceptions.JedisException; 

import java.util.HashMap; 
import java.util.Map; 
import java.util.Set; 
import redis.clients.jedis.exceptions.JedisException; 

public class Test { 

    //address of your redis server 
    private static final String redisHost = "10.0.0.10"; 
    private static final Integer redisPort = 11211; 

    //remember to increase sensder queue size 
    public void addSets() { 
     JedisPoolConfig poolConfig = new JedisPoolConfig(); 
     poolConfig.setMaxIdle(50); 
     poolConfig.setMaxTotal(1000); 
     poolConfig.setTestOnBorrow(true); 
     poolConfig.setTestOnReturn(true); 
     JedisPool pool = new JedisPool(poolConfig,redisHost, redisPort,10000000); 
     Jedis jedis= null; 
     String key = "shivd"; 
     long [] bits = {1464236631,12373513,1488983657,1329373495,147236649,1623846793,1194510359,282099785,1758709929,1059647223,416962921,1893573065,924784087,551826057,2028436201}; 

     //get a jedis connection jedis connection pool 
     try { 
      jedis = pool.getResource(); 
      Pipeline pipeline = jedis.pipelined(); 

      for (long b : bits) { 

       pipeline.setbit(key, b, true); 
      } 
      pipeline.multi(); 
      pipeline.exec(); 

     } finally { 
      if (jedis != null) { 
       jedis.close(); 
      } 
     } 
     pool.destroy(); 

    } 
    public static void main(String[] args){ 
     Test main = new Test(); 
     main.addSets(); 
     //main.cal(); 
     //main.addHash(); 
    } 
} 

제한을 약간 줄이면 작동합니다. 여기 가 레디 스 어댑터를 사용하여 두 캐시 서버의 로그입니다 :

dc1.log (10.0.0.10) - I 키

dc1.log

dc2.log를 삽입하고 곳 (복제가 발생하는 경우)

dc2.log

답변

0

귀하의 오드 서버의 메모리가 부족합니다. 마지막 값은 2028436201이며, 메모리에 저장하려면 약 253MB가 필요합니다. 당신의 오프셋이 큰, 당신은 또한 가장 낮은 오프셋 (offset) 귀하의 비트 세트를 기반으로 시도 할 수있는 경우

gfsh>start server --name=serv1 --max-heap=2G 

:

당신은 같은과 오드 서버에 더 많은 메모리를 제공 할 수 있습니다. (즉, 저장하기 전에 각 오프셋에서 가장 낮은 오프셋을 뺀 다음 외부에서 가장 낮은 오프셋을 유지).

관련 문제