Question

I am new to riak and I have installed the RIAK and PHP Client in Ubuntu 13.10. I have a problem while saving the data in the Riak using the PHP client. I have downloaded the Riak php client from the git hub and done a simple string insertion. But the request taking so long. I have waited about 30 to 40 mins. Even then also I didn't get response from the server.

I have used the following code.

<?php
require_once('riak-php-client/src/Basho/Riak/Bucket.php');
require_once('riak-php-client/src/Basho/Riak/Exception.php');
require_once('riak-php-client/src/Basho/Riak/Link.php');
require_once('riak-php-client/src/Basho/Riak/MapReduce.php');
require_once('riak-php-client/src/Basho/Riak/Object.php');
require_once('riak-php-client/src/Basho/Riak/StringIO.php');
require_once('riak-php-client/src/Basho/Riak/Utils.php');
require_once('riak-php-client/src/Basho/Riak/Link/Phase.php');
require_once('riak-php-client/src/Basho/Riak/MapReduce/Phase.php');
require_once('riak-php-client/src/Basho/Riak/Riak.php');

# Connect to Riak
$client = new Basho\Riak\Riak('127.0.0.1', 10017);

# Choose a bucket name
$bucket = $client->bucket('test');

# Supply a key under which to store your data
$person = $bucket->newObject('riak_developer_1', array(
                             'name' => "John Smith",
                             'age' => 28,
                             'company' => "Facebook"
                             ));

# Save the object to Riak
//echo '<PRE>';
//print_r($person);exit;
$person->store();

# Fetch the object
$person = $bucket->get('riak_developer_1');

# Update the object
$person->data['company'] = "Google";
$person->store();


?>

I have taken the code from the git hub from where I have downloaded and installed the Riak-Php-Client in the "GitHub Riak-Php-Client".

When I print the riak object before calling the store function I am getting the data in the riak object. If required I can post that object also. Please help. I am not getting any error also.

Thanks in advance.

Était-ce utile?

La solution

The current version of the PHP client does not support Protocol Buffers. If your node has default settings, port 10017 is used for Protocol Buffer connections while port 10018 is used for HTTP connections.

Please change the port to 10018 in your example and try again.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top