2
我试图插入数据到卡桑德拉。我有1M4整数的列表,我想在一个表与下面的架构中插入:卡桑德拉写超时写作
CREATE TABLE IF NOT EXISTS my_table (
node_id bigint,
screen_name text,
centrality float,
friend_follower_id bigint,
is_friend boolean,
is_follower boolean,
PRIMARY KEY ((node_id), friend_follower_id));
插入数据我做了以下内容:
prepared_statement = session.prepare("INSERT INTO {0} (node_id, screen_name, friend_follower_id, centrality, is_follower) VALUES ({1}, {2}, ?, {3}, true)".format("met_table", author_id, author_username, 0.0)
execute_concurrent_with_args(session, prepared_statement, zip(followers))
的错误,如:
cassandra.WriteTimeout: Error from server: code1100 [Coordinator node timed out waiting for replica nodes' responses] message="Operation timed -out received only 0 responses." info={'consistency': LOCAL_ONE, 'received_response':0, 'required_response':1}
如何在写入大量数据时避免超时?
我正在使用localhost。我的复制因子设置为2. – mel
我增加了(x10)write_request_timeout,但是我遇到的问题是让我的电脑速度非常慢,我认为这卡住了我的代码。一半数据已被插入,但其他数据未被插入。我计算我想插入的列表的大小,大小约为10MB,是一个正常的Usecase?我应该把它分成小块吗? – mel