无法通过PHP在Apache Phoenix中UPSERT记录

时间:2015-10-14 11:26:33

标签: php hbase phoenix

我正在尝试从<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <div> <span>Bye!</span> </div>jQuery Documentation中选择和UPSERT值。我可以PHP使用select查询端口php curl上安装的服务器,就像我在示例中分享一样。 同样,我试图使用PHP Curl在Phoenix中插入数据8765。它给了我响应,但数据没有插入。

PHP

(UPSERT)

输出:

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://localhost:8765/");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$headers = array();
// For Select.
//$headers[] = 'request: {"request":"prepareAndExecute","connectionId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","sql":"select * from BLOG.POST"}';

// For Upsert.
$headers[] = 'request: {"request":"prepareAndExecute","connectionId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","sql":"UPSERT INTO BLOG.POST (POST_ID,TITLE,CONTENT) values (\'aa11111\',\'Test Title\',\'this is test post content\')"}';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$server_output = curl_exec ($ch);
curl_close ($ch);

所以有人可以建议我的方法有什么不对吗?或者通过php类连接Apache phoenix的任何其他方法。

1 个答案:

答案 0 :(得分:0)

您好,您只需要关注hbase配置文件中的内容。

phoenix.connection.autoCommit = true to hbase-site.xml