我在重新启动后(在新的虚拟机实例上)让现有的Cassandra节点再次加入群集时遇到问题.
根据nodetool状态,我有一个运行的Cassandra集群,其中4个节点都处于"up and normal"状态.节点在Azure中的虚拟机上运行.我更改了10.0.0.6的虚拟机的实例类型,该类型在重新启动此计算机时返回.机器停留在10.0.0.6.重新启动后,我无法再次启动Cassandra.我得到这个例外:
INFO 22:39:07 Handshaking version with /10.0.0.4
INFO 22:39:07 Node /10.0.0.6 is now part of the cluster
INFO 22:39:07 Node /10.0.0.5 is now part of the cluster
INFO 22:39:07 Handshaking version with cassandraprd001/10.0.0.6
INFO 22:39:07 Node /10.0.0.9 is now part of the cluster
INFO 22:39:07 Handshaking version with /10.0.0.5
INFO 22:39:07 Node /10.0.0.4 is now part of the cluster
INFO 22:39:07 InetAddress /10.0.0.6 is now UP
INFO 22:39:07 Handshaking version with /10.0.0.9
INFO 22:39:07 InetAddress /10.0.0.4 is …Run Code Online (Sandbox Code Playgroud) 如何使用Datastax C#驱动程序对timeuuid数据类型的CQL查询中的"大于"或"小于"where条件?
我在Cassandra有一个表,用于存储按时间戳排序的cookie历史记录作为timeuuid:
CREATE TABLE cookie_history (
cookie_id text,
create_date timeuuid,
item_id text,
PRIMARY KEY ((cookie_id), create_date)
);
Run Code Online (Sandbox Code Playgroud)
使用C#类映射表以使用Datastax C#Cassandra驱动程序进行查询:
[Table("cookie_history")]
public class CookieHistoryDataEntry
{
[PartitionKey(1)]
[Column("cookie_id")]
public string CookieID;
[ClusteringKey(1)]
[Column("create_date")]
public Guid CreateDate;
[Column("item_id")]
public string ItemID;
}
Run Code Online (Sandbox Code Playgroud)
对于给定的cookie,我想要在给定时间戳之后的所有项目.
var myTimeUuid = new Guid("5812e74d-ba49-11e3-8d27-27303e6a4831");
var table = session.GetTable<CookieHistoryDataEntry>();
var query = table.Where(x => x.CookieID == myCookieId
&& x.CreateDate > myTimeUuid);
Run Code Online (Sandbox Code Playgroud)
但是这个(x.CreateDate> myTimeUuid)给了我一个编译时错误:
Operator '>' cannot be applied to operands of type 'System.Guid' and 'System.Guid'
Run Code Online (Sandbox Code Playgroud) 什么C#类型相当于Datastax Cassandra C#驱动程序中的timeuuid?
我正在编写一个简单的用户跟踪服务,并希望访问最新的用户历史记录.我正在尝试创建一个与此create语句等效的表:
CREATE TABLE IF NOT EXISTS user_history (
user_id text,
event_type text,
create_date timeuuid,
item_id text,
PRIMARY KEY ((user_id, event_type), create_date)
);
Run Code Online (Sandbox Code Playgroud)
我做了以下课程:
[AllowFiltering]
[Table("user_history")]
public class UserHistory
{
[PartitionKey(1)]
[Column("user_id")]
public string UserID;
[PartitionKey(2)]
[Column("event_type")]
public string EventType;
[ClusteringKey(1)]
[Column("create_date")]
public DateTime CreateDate { get; set; }
[Column("item_id")]
public string ItemID;
}
Run Code Online (Sandbox Code Playgroud)
我正在使用此语句在Cassandra中创建表:
var table = Session.GetTable<UserHistory>();
table.CreateIfNotExists();
Run Code Online (Sandbox Code Playgroud)
但是这给了我下面的表格:
CREATE TABLE user_history (
user_id text,
event_type text,
create_date timestamp,
item_id text,
PRIMARY KEY ((user_id, event_type), create_date) …Run Code Online (Sandbox Code Playgroud)