2017-12-04 1 views
0

Java Ubuntu의 Riak 서버에 Java Eclipse를 연결하려고합니다. 일부 가이드를 추적했지만 여전히 작동하지 않습니다. 사용 : - Riak - 클라이언트 2.0.2 - 이클립스 Oxygen.1a 릴리스 (4.7.1a) - 우분투 16.04.3 - 오픈 JDK 버전 "1.8.0_151는"Java Riak 연결 문제

유무가 SLF4J에 몇 가지 문제가 전에 있었다 그래서 나는 외부 항아리를 추가했다 : 그것을 해결하기 위해 slf4j-jdk14-1.7.25-sources.

내 코드 :

import com.basho.riak.client.api.RiakClient; 
import com.basho.riak.client.api.commands.kv.FetchValue; 
import com.basho.riak.client.api.commands.kv.StoreValue; 
import com.basho.riak.client.core.query.Location; 
import com.basho.riak.client.core.query.Namespace; 


import java.net.UnknownHostException; 
import java.util.concurrent.ExecutionException; 

public class ProdukteEinlesen { 
    public static void main(String [] args) throws UnknownHostException, ExecutionException, InterruptedException { 

     RiakClient client = RiakClient.newClient(8098, "127.0.0.1"); 
     Location location = new Location(new Namespace("TestBucket"),"TestKey"); 

     FetchValue fv = new FetchValue.Builder(location).build(); 
     FetchValue.Response response = client.execute(fv); 

     // Fetch object as String 
     String value = response.getValue(String.class); 
     System.out.println(value); 

     client.shutdown(); 
    } 
} 

지금 내가이 무엇입니까 :

Dez 04, 2017 5:58:23 PM com.basho.riak.client.core.RiakNode start 
INFORMATION: RiakNode started; 127.0.0.1:8098 
Dez 04, 2017 5:58:23 PM com.basho.riak.client.core.RiakCluster start 
INFORMATION: RiakCluster is starting. 
Dez 04, 2017 6:03:20 PM com.basho.riak.client.core.RiakNode$2 operationComplete 
SCHWERWIEGEND: inAvailable channel closed; id:-2083854054 127.0.0.1:8098 
Dez 04, 2017 6:03:20 PM com.basho.riak.client.core.RiakNode$2 operationComplete 
SCHWERWIEGEND: inAvailable channel closed; id:674162571 127.0.0.1:8098 
Dez 04, 2017 6:03:20 PM com.basho.riak.client.core.RiakNode$2 operationComplete 
SCHWERWIEGEND: inAvailable channel closed; id:1161062152 127.0.0.1:8098 
Dez 04, 2017 6:03:20 PM com.basho.riak.client.core.RiakNode$2 operationComplete 
SCHWERWIEGEND: inAvailable channel closed; id:-1411904647 127.0.0.1:8098 
Dez 04, 2017 6:03:20 PM com.basho.riak.client.core.RiakNode$2 operationComplete 
SCHWERWIEGEND: inAvailable channel closed; id:-1369356068 127.0.0.1:8098 
Dez 04, 2017 6:03:20 PM com.basho.riak.client.core.RiakNode$2 operationComplete 
SCHWERWIEGEND: inAvailable channel closed; id:957736106 127.0.0.1:8098 
Dez 04, 2017 6:03:20 PM com.basho.riak.client.core.RiakNode$2 operationComplete 
SCHWERWIEGEND: inAvailable channel closed; id:-1598195494 127.0.0.1:8098 
Dez 04, 2017 6:03:20 PM com.basho.riak.client.core.RiakNode$2 operationComplete 
SCHWERWIEGEND: inAvailable channel closed; id:-1723639977 127.0.0.1:8098 
Dez 04, 2017 6:03:20 PM com.basho.riak.client.core.RiakNode$2 operationComplete 
SCHWERWIEGEND: inAvailable channel closed; id:-1232050671 127.0.0.1:8098 
Dez 04, 2017 6:03:20 PM com.basho.riak.client.core.RiakNode$3 operationComplete 
SCHWERWIEGEND: Channel closed while operation in progress; id:-459317961 127.0.0.1:8098 
Dez 04, 2017 6:08:17 PM com.basho.riak.client.core.RiakNode healthCheckFailed 
SCHWERWIEGEND: RiakNode failed healthcheck operation; health checking; 127.0.0.1:8098 java.io.IOException: Channel closed while performing health check op. 
Dez 04, 2017 6:08:17 PM com.basho.riak.client.core.DefaultNodeManager nodeStateChanged 
INFORMATION: NodeManager moved node to unhealthy list; 127.0.0.1:8098 
Dez 04, 2017 6:08:17 PM com.basho.riak.client.core.RiakNode$3 operationComplete 
SCHWERWIEGEND: Channel closed while operation in progress; id:-1254319488 127.0.0.1:8098 
Exception in thread "main" java.util.concurrent.ExecutionException: com.basho.riak.client.core.NoNodesAvailableException 
    at com.basho.riak.client.core.FutureOperation.get(FutureOperation.java:260) 
    at com.basho.riak.client.api.commands.CoreFutureAdapter.get(CoreFutureAdapter.java:52) 
    at com.basho.riak.client.api.RiakCommand.execute(RiakCommand.java:89) 
    at com.basho.riak.client.api.RiakClient.execute(RiakClient.java:293) 
    at ProdukteEinlesen.main(ProdukteEinlesen.java:18) 
Caused by: com.basho.riak.client.core.NoNodesAvailableException 
    at com.basho.riak.client.core.RiakCluster.retryOperation(RiakCluster.java:468) 
    at com.basho.riak.client.core.RiakCluster.access$1000(RiakCluster.java:47) 
    at com.basho.riak.client.core.RiakCluster$RetryTask.run(RiakCluster.java:553) 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) 
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
    at java.lang.Thread.run(Thread.java:748) 

내 Riak DB는 잘 명령을 통해 이미 맛 노력하고 있습니다.

답변

1

Riak 연결에 잘못된 포트 번호가 사용되고있는 것 같습니다. 프로토콜 버퍼 API의 올바른 포트는 8087입니다 (기본값을 변경하지 않았다고 가정). 포트 8098은 HTTP 용이므로 cURL 또는 다른 HTTP 클라이언트로 서버를 테스트해야합니다. 다음과 같이 Java 코드가 있어야한다 :

RiakClient client = RiakClient.newClient(8087, "127.0.0.1");