此操作不支持一致性级别 LOCAL_ONE。支持的一致性级别是:LOCAL_QUORUM

Consistency level LOCAL_ONE is not supported for this operation. Supported consistency levels are: LOCAL_QUORUM

我正在使用 AWS 键空间并尝试从 C# 插入数据但收到此错误。"Consistency level LOCAL_ONE is not supported for this operation. Supported consistency levels are: LOCAL_QUORUM"。任何人都可以在这里帮忙。

AWS 密钥空间

CREATE KEYSPACE IF NOT EXISTS "DevOps"
   WITH REPLICATION={'class': 'SingleRegionStrategy'} ;

Table

CREATE TABLE IF NOT EXISTS "DevOps"."projectdetails" (
"id" UUID PRIMARY KEY,
"name" text,
"lastupdatedtime" timestamp,
"baname" text,
"customerid" UUID)

C#代码

 public async Task AddRecord(List<projectdetails> projectDetails)
        {

            try
            {
                if (projectDetails.Count > 0)
                {
                    foreach (var item in projectDetails)
                    {
                        projectdetails projectData = new projectdetails();
                        projectData.id = item.id;
                        projectData.name = item.name;
                        projectData.baname = "Vishal";
                        projectData.lastupdatedtime = item.lastupdatedtime;
                        projectData.customerid = 1;
                        await mapper.InsertAsync<projectdetails>(projectData);
                    }
                }
            }

            catch (Exception e) 
            { 

            }
        }

错误清楚地表明您需要使用正确的一致性级别 LOCAL_QUORUM 而不是默认使用的 LOCAL_ONEAWS documentation says that for write operations, it's only the consistency level supported. You can set consistency level by using the version of InsertAsync that accepts the CqlQueryOptions,像这样(也许只创建一次查询选项的实例,在应用程序初始化期间):

mapper.InsertAsync<projectdetails>(projectData, 
  new CqlQueryOptions().SetConsistencyLevel(ConsistencyLevel.LocalQuorum))