ubuntuでエアロスパイクを使用しています。
コマンド ラインで aerospike のレコードを設定および取得できます。
PHP では、AeroSpike クラスをインスタンス化できますが、それにデータを追加しようとすると、「AEROSPIKE_ERR_NAMESPACE_NOT_FOUND」と表示されます。
驚くべきことに、エラー コードは 20 ですが、ドキュメントでは 501 である必要があります。APIで定義されたそのようなエラーコード20はありません。
https://github.com/aerospike/aerospike-client-nodejs/blob/master/docs/status.md
私が試したコード。
<?php
ini_set( 'display_errors', 1 );
ini_set( 'error_reporting', E_ALL );
// set the records to never expire unless specified otherwise
define( 'RECORD_TIME_TO_LIVE', 0 );
$config = array(
"hosts" => array(
array( "addr" => "127.0.0.1", "port" => 3000 )
)
);
$db = new Aerospike( $config );
// failure check
if ( !$db->isConnected() ) {
echo "Failed to connect to the Aerospike server [{$db->errorno()}]: {$db->error()}\n";
exit( 1 );
}
$key = $db->initKey("infosphere", "characters", 1);
$put_vals = array("name" => "Scruffy", "Occupation" => "The Janitor");
$status = $db->put($key, $put_vals, RECORD_TIME_TO_LIVE);
if($status == Aerospike::OK) {
echo "Record written.\n";
} elseif ($status == Aerospike::ERR_RECORD_EXISTS) {
echo "The Aerospike server already has a record with the given key.\n";
} else {
echo "[{$db->errorno()}] :".$db->error();
}
$db->close();
?>
どんな助けでも大歓迎です。
ありがとう、