You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@accumulo.apache.org by Benjamin Parrish <be...@gmail.com> on 2013/09/13 18:16:49 UTC

Error running client code

I am having what seems to be a usual error people see, but I am not sure administratively what to do to fix it.

This is my code:

public static void main(String[] args) throws TableNotFoundException, AccumuloException, AccumuloSecurityException {
	String instanceName = "accumulo";
	String zooServers = "10.200.20.37";
	Instance inst = new ZooKeeperInstance(instanceName, zooServers);

	Connector conn = inst.getConnector("root", "secret");
		
	Text rowID = new Text("row1");
	Text colFam = new Text("myColFam");
	Text colQual = new Text("myColQual");
	ColumnVisibility colVis = new ColumnVisibility("public");
	long timestamp = System.currentTimeMillis();

	Value value = new Value("myValue".getBytes());

	Mutation mutation = new Mutation(rowID);
	mutation.put(colFam, colQual, colVis, timestamp, value);
		
	long memBuf = 1000000L; // bytes to store before sending a batch
	long timeout = 1000L; // milliseconds to wait before sending
	int numThreads = 10;

	BatchWriter writer = conn.createBatchWriter("table", memBuf, timeout, numThreads);

	writer.addMutation(mutation);

	writer.close();
}

This is the error I see in Eclipse:

13/09/13 12:10:22 WARN impl.ServerClient: Failed to find an available server in the list of servers: [127.0.0.1:9997:9997 (120000)]

Everything is operational to the best of my knowledge.  I can run scans on tables in the terminal.

Re: Error running client code

Posted by John Vines <vi...@apache.org>.
Not really, a configurator has been on my back burner (and probably
others), but I just haven't gotten to it. FWIW, that's the only issue you
should be hitting WRT accessing accumulo instances externally. In the docs,
we sorta clue in on good practices, but they really do depend on system
resources. We could probably do better to document them.


On Fri, Sep 13, 2013 at 2:10 PM, Benjamin Parrish <
benjamin.d.parrish@gmail.com> wrote:

> Thanks John!  That did it.  Is there a good resource for setting up an
> Accumulo instance?  I took a VM that already set it up to get a proof of
> concept going, and now I want to refactor and go back and set up a box from
> scratch.
>
>
> On Sep 13, 2013, at 12:24 PM, John Vines <vi...@apache.org> wrote:
>
> Short answer - update your slaves file to use IP address/hostname that
> isn't 127.0.0.1/localhost
>
> Long answer - teh start-all.sh script uses the items in the slaves files
> (as well as the others) as hints for which IP to report in zookeeper. The
> client code looks this information up in ZooKeeper to determine which IP it
> needs to talk to. So if you have localhost in the slaves file, the tserver
> will report that it's running on 127.0.0.1. So when you run client code
> from a different box, it reads that it needs to connect to 127.0.0.1 to
> find that tserver, but 127.0.0.1 on the client's box points to itself, so
> the connection fails.
>
>
> On Fri, Sep 13, 2013 at 12:16 PM, Benjamin Parrish <
> benjamin.d.parrish@gmail.com> wrote:
>
>> I am having what seems to be a usual error people see, but I am not sure
>> administratively what to do to fix it.
>>
>> This is my code:
>>
>> public static void main(String[] args) throws TableNotFoundException,
>> AccumuloException, AccumuloSecurityException {
>>  String instanceName = "accumulo";
>>  String zooServers = "10.200.20.37";
>> Instance inst = new ZooKeeperInstance(instanceName, zooServers);
>>
>> Connector conn = inst.getConnector("root", "secret");
>>
>> Text rowID = new Text("row1");
>>  Text colFam = new Text("myColFam");
>>  Text colQual = new Text("myColQual");
>>  ColumnVisibility colVis = new ColumnVisibility("public");
>>  long timestamp = System.currentTimeMillis();
>>
>> Value value = new Value("myValue".getBytes());
>>
>> Mutation mutation = new Mutation(rowID);
>>  mutation.put(colFam, colQual, colVis, timestamp, value);
>>
>> long memBuf = 1000000L; // bytes to store before sending a batch
>>  long timeout = 1000L; // milliseconds to wait before sending
>>  int numThreads = 10;
>>
>> BatchWriter writer = conn.createBatchWriter("table", memBuf, timeout,
>> numThreads);
>>
>> writer.addMutation(mutation);
>>
>> writer.close();
>> }
>>
>> This is the error I see in Eclipse:
>>
>> 13/09/13 12:10:22 WARN impl.ServerClient: Failed to find an available
>> server in the list of servers: [127.0.0.1:9997:9997 (120000)]
>>
>> Everything is operational to the best of my knowledge.  I can run scans
>> on tables in the terminal.
>>
>
>
>

Re: Error running client code

Posted by Benjamin Parrish <be...@gmail.com>.
Thanks John!  That did it.  Is there a good resource for setting up an Accumulo instance?  I took a VM that already set it up to get a proof of concept going, and now I want to refactor and go back and set up a box from scratch.


On Sep 13, 2013, at 12:24 PM, John Vines <vi...@apache.org> wrote:

> Short answer - update your slaves file to use IP address/hostname that isn't 127.0.0.1/localhost
> 
> Long answer - teh start-all.sh script uses the items in the slaves files (as well as the others) as hints for which IP to report in zookeeper. The client code looks this information up in ZooKeeper to determine which IP it needs to talk to. So if you have localhost in the slaves file, the tserver will report that it's running on 127.0.0.1. So when you run client code from a different box, it reads that it needs to connect to 127.0.0.1 to find that tserver, but 127.0.0.1 on the client's box points to itself, so the connection fails.
> 
> 
> On Fri, Sep 13, 2013 at 12:16 PM, Benjamin Parrish <be...@gmail.com> wrote:
> I am having what seems to be a usual error people see, but I am not sure administratively what to do to fix it.
> 
> This is my code:
> 
> public static void main(String[] args) throws TableNotFoundException, AccumuloException, AccumuloSecurityException {
> 	String instanceName = "accumulo";
> 	String zooServers = "10.200.20.37";
> 	Instance inst = new ZooKeeperInstance(instanceName, zooServers);
> 
> 	Connector conn = inst.getConnector("root", "secret");
> 		
> 	Text rowID = new Text("row1");
> 	Text colFam = new Text("myColFam");
> 	Text colQual = new Text("myColQual");
> 	ColumnVisibility colVis = new ColumnVisibility("public");
> 	long timestamp = System.currentTimeMillis();
> 
> 	Value value = new Value("myValue".getBytes());
> 
> 	Mutation mutation = new Mutation(rowID);
> 	mutation.put(colFam, colQual, colVis, timestamp, value);
> 		
> 	long memBuf = 1000000L; // bytes to store before sending a batch
> 	long timeout = 1000L; // milliseconds to wait before sending
> 	int numThreads = 10;
> 
> 	BatchWriter writer = conn.createBatchWriter("table", memBuf, timeout, numThreads);
> 
> 	writer.addMutation(mutation);
> 
> 	writer.close();
> }
> 
> This is the error I see in Eclipse:
> 
> 13/09/13 12:10:22 WARN impl.ServerClient: Failed to find an available server in the list of servers: [127.0.0.1:9997:9997 (120000)]
> 
> Everything is operational to the best of my knowledge.  I can run scans on tables in the terminal.
> 


Re: Error running client code

Posted by John Vines <vi...@apache.org>.
Short answer - update your slaves file to use IP address/hostname that
isn't 127.0.0.1/localhost

Long answer - teh start-all.sh script uses the items in the slaves files
(as well as the others) as hints for which IP to report in zookeeper. The
client code looks this information up in ZooKeeper to determine which IP it
needs to talk to. So if you have localhost in the slaves file, the tserver
will report that it's running on 127.0.0.1. So when you run client code
from a different box, it reads that it needs to connect to 127.0.0.1 to
find that tserver, but 127.0.0.1 on the client's box points to itself, so
the connection fails.


On Fri, Sep 13, 2013 at 12:16 PM, Benjamin Parrish <
benjamin.d.parrish@gmail.com> wrote:

> I am having what seems to be a usual error people see, but I am not sure
> administratively what to do to fix it.
>
> This is my code:
>
> public static void main(String[] args) throws TableNotFoundException,
> AccumuloException, AccumuloSecurityException {
>  String instanceName = "accumulo";
>  String zooServers = "10.200.20.37";
> Instance inst = new ZooKeeperInstance(instanceName, zooServers);
>
> Connector conn = inst.getConnector("root", "secret");
>
>
> Text rowID = new Text("row1");
>  Text colFam = new Text("myColFam");
>  Text colQual = new Text("myColQual");
>  ColumnVisibility colVis = new ColumnVisibility("public");
>  long timestamp = System.currentTimeMillis();
>
> Value value = new Value("myValue".getBytes());
>
> Mutation mutation = new Mutation(rowID);
>  mutation.put(colFam, colQual, colVis, timestamp, value);
>
>
> long memBuf = 1000000L; // bytes to store before sending a batch
>  long timeout = 1000L; // milliseconds to wait before sending
>  int numThreads = 10;
>
> BatchWriter writer = conn.createBatchWriter("table", memBuf, timeout,
> numThreads);
>
> writer.addMutation(mutation);
>
> writer.close();
> }
>
> This is the error I see in Eclipse:
>
> 13/09/13 12:10:22 WARN impl.ServerClient: Failed to find an available
> server in the list of servers: [127.0.0.1:9997:9997 (120000)]
>
> Everything is operational to the best of my knowledge.  I can run scans on
> tables in the terminal.
>