尝试从 phpcassa 实例化 column_family 对象时发生 Cassandra_NotFound 异常

发布于 2024-12-04 11:43:13 字数 1565 浏览 1 评论 0原文

我在我的 Windows 7 计算机(64 位)中设置了 Cassandra 实例 0.7。

cassandra 服务器已启动并正在运行,并且成功侦听 Thrift 客户端。我通过成功创建自己的示例键空间和列族来测试该实例。

现在,我必须从我的 PHP 脚本连接到这个 Cassandra 实例。我尝试使用 thobbs\phpcassa

在这里我遇到了麻烦。在安装中提到了 UNIX/Linux 系统的'make,build'步骤,但没有提到 Windows 系统。

不知道下一步该做什么,我尝试将 phpcassa 文件夹复制到我的 htdocs 文件夹(apache 的)中,并创建一个测试文件 cassandra_test.php ,其中包含以下内容:

<?php
ini_set('display_errors',1);
require_once('phpcassa/connection.php');
require_once('phpcassa/columnfamily.php');

$servers = array("localhost:9160");
$pool = new ConnectionPool("demo", $servers);

$column_family = new ColumnFamily($pool, 'user');


?>

demo 是我拥有的示例键空间从命令提示符创建。另外,我在演示键空间中创建了一个示例 column_family user

在浏览器中执行此脚本会出现以下异常:

Fatal error: Uncaught exception 'cassandra_NotFoundException' in C:\Program Files   (x86)\Apache Software Foundation\Apache2.2\htdocs\phpcassa\columnfamily.php:198 
Stack trace: #0 C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\cassandra_test.php(10): 
ColumnFamily->__construct(Object(ConnectionPool), 'user') #1 {main} thrown in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\phpcassa\columnfamily.php
on line 198 

I think phpcassa can't find my local cassandra instance 。如何检查?

$pool = new ConnectionPool("demo", $servers);

没有给出任何错误/警告。所以,我完全不确定这个异常的根本原因是什么? 我是 cassandra 和 PHPcassa 的新手。如果这个问题听起来很微不足道,我真的很抱歉。

I have setup a Cassandra instance 0.7 in my Windows 7 machine (64bit) .

The cassandra server is up and running and it is successfully listening to thrift clients. I have tested the instance by successfully creating my own sample keyspace and column family .

Now , I have to connect to this Cassandra instance from my PHP script . I tried using thobbs\phpcassa .

Here I ran into trouble . In the installation it's mentioned the steps for 'make,build' for UNIX/Linux system but nothing is mentioned for Windows .

Knowing not what to do next , I tried to copy the phpcassa folder inside my htdocs folder (of apache) and created a test file cassandra_test.php with the following content:

<?php
ini_set('display_errors',1);
require_once('phpcassa/connection.php');
require_once('phpcassa/columnfamily.php');

$servers = array("localhost:9160");
$pool = new ConnectionPool("demo", $servers);

$column_family = new ColumnFamily($pool, 'user');


?>

demo is the sample keyspace that I have created from the command prompt . Also , I have created a sample column_family user in my demo keyspace.

Executing this script in my browser gives me the following exception:

Fatal error: Uncaught exception 'cassandra_NotFoundException' in C:\Program Files   (x86)\Apache Software Foundation\Apache2.2\htdocs\phpcassa\columnfamily.php:198 
Stack trace: #0 C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\cassandra_test.php(10): 
ColumnFamily->__construct(Object(ConnectionPool), 'user') #1 {main} thrown in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\phpcassa\columnfamily.php
on line 198 

I think phpcassa can't find my local cassandra instance . How to check that ?

Also

$pool = new ConnectionPool("demo", $servers);

didn't gave any error/warning . So , I am entirely not sure what's the root cause for this exception?
I am a newbie for cassandra and PHPcassa .Really sorry if this problem sounded pretty trivial.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

守护在此方 2024-12-11 11:43:13

此异常表明它能够连接到您的 Cassandra 实例(可能没有任何问题),但键空间“演示”中的 ColumnFamily“用户”不存在。

尝试启动 cassandra-cli 并验证“show keyspaces;”列出正确键空间内的列族。另请注意,此处名称区分大小写(如果有区别的话)。

This Exception indicates that it was able to connect to your Cassandra instance (probably without any problems), but that the ColumnFamily "user" in the keyspace "demo" does not exist.

Try starting cassandra-cli and verify that "show keyspaces;" lists the column family inside the correct keyspace. Also be aware that names are case-sensitive here, if that makes a difference.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文