Jedis

2017-12-08 19 views
0

私はJedis

  boolean useSsl = false; 
      /* In this line, replace <name> with your cache name: */ 
      JedisShardInfo shardInfo = new JedisShardInfo("HOST_NAME", 6379, useSsl); 
      shardInfo.setPassword(ACCESS_KEY); /* Use your access key. */ 
      shardInfo.setConnectionTimeout(999999); 
      shardInfo.setSoTimeout(999999); 
      Jedis jedis = new Jedis(shardInfo); 
      jedis.set("foo", "bar"); 
      String value = jedis.get("foo"); 

私は以下の例外しばらく取得しています自分のサイト上で与えられたサンプルコードを使用してAzureの外側から、AzureのReddisキャッシュサービスに接続しようとしていますを使用してサービスとしてAzureのReddisCachéに接続Azureの

Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketException: Software caused connection abort: recv failed 
     at redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:202) 
     at redis.clients.util.RedisInputStream.readByte(RedisInputStream.java:40) 
     at redis.clients.jedis.Protocol.process(Protocol.java:151) 
     at redis.clients.jedis.Protocol.read(Protocol.java:215) 
     at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:340) 
     at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:239) 
     at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:96) 
     at redis.clients.jedis.Connection.sendCommand(Connection.java:126) 
     at redis.clients.jedis.BinaryClient.set(BinaryClient.java:110) 
     at redis.clients.jedis.Client.set(Client.java:47) 
     at redis.clients.jedis.Jedis.set(Jedis.java:120) 
     at com.oriental.redis.cache.TestClient.main(TestClient.java:65) 
Caused by: java.net.SocketException: Software caused connection abort: recv failed 
     at java.net.SocketInputStream.socketRead0(Native Method) 
     at java.net.SocketInputStream.socketRead(Unknown Source) 
     at java.net.SocketInputStream.read(Unknown Source) 
     at java.net.SocketInputStream.read(Unknown Source) 
     at java.net.SocketInputStream.read(Unknown Source) 
     at redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:196) 
     ... 11 more 

エラーの外部からプログラムを実行すると、AzureのRedisのサーバーが接続を認めないことを示唆しています。 私は基本的なAzureサブスクリプションを使用しているため、プレミアムインスタンスを作成していません。ファイアウォール/ IPアクセスフィルタはPremiumバージョンのAzure Redis Cacheにのみ適用されます。

これは私を混乱させます。どんな助けもありがとう。

答えて

0

ポート6379(非SSLポート)に接続する場合は、明示的にそのポートをオンにする必要があります。デフォルトでは、Azure Redisは暗号化された接続を必要とします(ポート6380経由)。詳細はhttps://docs.microsoft.com/en-us/azure/redis-cache/cache-configure#access-portsを参照してください。

+0

ありがとう@JonCole、私はすでに6379をオンにしましたが、ネットワークファイアウォールが外側の紺碧の雲への接続をブロックしていたという問題がありました。ポートの発信接続がブロック解除されると、正常に動作し始めました。 –

関連する問題