草庐IT

cassandra-driver

全部标签

gocql 阻塞太多并发读取请求(golang,Cassandra)

使用GOCQL(Golang、Cassandra),我最多发出128个请求,然后一切都挂起。我相信我正确发布查询的getTicksForCassandraKey()函数,但不确定。GOCQL最多只支持128个并发查询,所以我一定是做错了什么。所有查询都是读取的。主要代码为:inboundChannel:=make(chan[]bson.M,30)maxGoRoutinesCount:=30chunkSize:=int(math.Floor(float64(len(cassandraKeys))/float64(maxGoRoutinesCount)))log.Println("Chun

go - cassandra中复合键的二级索引

我在cassandra中有这张表CREATETABLEglobal_product_highlights(deal_idtext,product_idtext,highlight_strengthdouble,category_idtext,creation_datetimestamp,rankint,PRIMARYKEY(deal_id,product_id,highlight_strength))当我在Golang中触发以下查询时err=session.Query("selectproduct_idfromglobal_product_highlightswherecategory

mysql - 为什么我不能用 'goapp deploy' 部署到 GAE,我找不到导入 : "github.com/go-sql-driver/mysql"

主要问题:无法使用“goappdeploy”部署到GAE,不断收到此消息:src/mygoprog.go:11:找不到导入:“github.com/go-sql-driver/mysql”我已经部署了在端口8080上监听GAE的“helloworld”程序,没有任何问题;现在正在尝试部署更复杂的程序。这在本地测试时效果很好:C:\mysql\src>运行mygoprog.go尝试部署到GAE时不会:C:\mysql>goapp部署我重新安装了goappengine并从头开始使用go语言,并在卸载和安装之间清理了注册表。任何帮助将不胜感激。github安装命令:goapp获取github

windows - 无法创建连接到 Cassandra 的 session

我正在使用这个gocql包。我正在努力让这个例子发挥作用。funcmain(){//connecttotheclustercluster:=gocql.NewCluster("192.168.1.1","192.168.1.2","192.168.1.3")cluster.ProtoVersion=3cluster.Keyspace="example"cluster.Consistency=gocql.Quorumsession,err:=cluster.CreateSession()defersession.Close()iferr!=nil{fmt.Printf("%v\n",er

go - 使用 gocql 将用户定义类型的数组插入 Cassandra

我在Cassandra中有一个UDT,我有一个表,其架构中包含这些UDT的数组。这是一个示例:CREATETYPEkeyspace.test_type(xfloat,yfloat)在我的架构中我有CREATETABLEtest_table(keytext,test_arraylist>,PRIMARYKEY(key))在我的go包中,我构建了一个结构:typeTest_typestruct{xfloat32yfloat32}然后我有一个函数,它基本上返回这个test_type的列表:[]test_type,我们称它为my_array。当我尝试像这样使用gocql进行插入时:err:=g

mongodb - 如何使用struct使用mongo-go-driver的更新功能

mongo-go-driver的update函数可以这样调用。filter:=bson.D{"username",username}update:=bson.D{{"$set",bson.D{{"name",person.Name},},}}result,err:=collection.UpdateOne(ctx,filter,update)typePersonstruct{IDprimitive.ObjectID`json:"_id,omitempty"bson:"_id,omitempty"`Usernamestring`json:"username,omitempty"bson:

mysql - 如何使用 Go 和 go-sql-driver 连接到 mysql 服务器?

我正在学习教程here和here但是我无法连接到mySQL安装附带的test数据库。我可以通过命令行连接到mySql。我错过了什么?当我运行下面的代码时,出现错误“无法ping”:packagemainimport("fmt""database/sql"_"github.com/go-sql-driver/mysql")funcmain(){db,err:=sql.Open("mysql","/test")iferr!=nil{fmt.Println(err)return}deferdb.Close()err=db.Ping()iferr!=nil{fmt.Println("canno

go - 在 golang 中接受 Cassandra 的 Set 数据类型

我在cassandra中有一个类型为set的列。Usiggocql我想在golang代码中接受该列。因此,在接受整个集合被接受的变量的数据类型时应该是什么。例如:err=session.Query("selectproduct_listfromcategorywherecategory_id=?",key).Scan(&productIdList)product_list是set类型,那么golang中productIdList的数据类型应该是什么? 最佳答案 看起来gocql默认使用slice或数组作为Cassandra的集合类型

mongodb - 如何在 mongo-go-driver 中使用 ParseExtJSONArray() 解析聚合管道中的扩展 JSON 日期

我有一个包含日期字段的集合:{"_id":ObjectId("5b92b359ddceef5b24502834"),"dateTimeGMT":ISODate("2018-08-22T09:29:25.000Z"),yada,yada,yada}我正在尝试使用mongo-go-driver的ParseExtJSONArray函数在$match聚合阶段按日期查找。(我知道如何直接使用*bson.Array执行此操作。我在问,所以我知道使用ParserExtJSONArray执行此操作的正确方法,或者我是否遇到了限制。)我已简化此示例并确认它与上述文档不匹配。pipeline,err:=b

mongodb - 如何使用官方的 mongo-go-driver 连接到 MongoDB Atlas

这个问题在这里已经有了答案:HowtousenewURLfrommongodb3.6toconnectfromgolang(2个答案)关闭3年前。我正在查看tutorial配合官方发布提供mongo-go-driver并且连接示例使用localhost上的MongoDB服务器//SetclientoptionsclientOptions:=options.Client().ApplyURI("mongodb://localhost:27017")但是,新托管的MongoDB服务Atlas需要用户名和密码才能登录。连接字符串采用格式mongodb://[username:password