3

我是 Vitess 的新手,我们已经使用 Helm Charts 在 Kubernetes 中部署了 Vitess,并通过节点端口公开了 VTGate,并且能够使用公开的 VTGate Ip 地址连接 MYSQL 工作台。当我们使用 MySql Work Bench 插入记录时,记录不会分散在碎片中。

  * 'Payrolls' is the KeySpace and we created two shards as Payrolls -80,Payrolls 80-.

  * Table Schema as below

     1. TenantList
        (
           TenantID     INT,
           NAme      VARCHAR(200)
        )  


     2.  PayrollMaster
        (
          PayrollID   INT PRIMARY KEY,
          HHAID       INT FOREIGN KEY TO TenantList(TenantID)
        )  

     3. PayrollDetails
       (
         PayrollDetailID    INT PRIMARY KEY,
         PayrollID          INT FOREIGN KEY TO PayrollMaster(PayrollID),
         HHAID              INT FOREIGN KEY TO TenantList(TenantID)
       )

   *   VSchema is as below
      {
       "sharded": true,
       "vindexes": {
        "hash": {
         "type": "hash"
        }
     },
    "tables": {
     "payrollmaster": {
     "column_vindexes": 
      [
       {
         "column": "HHA",
         "name": "hash"
       }
      ],
      "auto_increment": {
       "column": "PayrollInternalID",
       "sequence": "payrollmaster_seq"
      }
    },
    "payrolldetails": {
     "column_vindexes": 
     [
       {
         "column": "HHA",
         "name": "hash"
       }
     ],
     "auto_increment": {
       "column": "PayrollDetailInternalID",
       "sequence": "payrolldetails_seq"
     }
   }
 }
}


    We are inserting the Records like below
      use Payrolls;
      insert into the TenantList,PayrollMaster,PayrollDetails

我们期望记录分散在分片中,但表在分片中的行数为零。

如屏幕截图中所述,创建了 Key Space 和 Shards

我们尝试的方式有什么问题吗?

谢谢

4

1 回答 1

2

看起来您希望对工资单进行分片。如果是这样,您不应该创建分片“0”。您应该只指定分片“-80”和“80-”

于 2020-03-13T15:36:43.280 回答