# Create Shards

Prerequisites for creating shards:

  • BitalosFE deployment completed
  • Bitalosdashboard deployment completed

There are 4 steps to create shards:

  • Deploy shards
  • Add shards in Bitalosdashboard
  • Enable nodes of shards accessible
  • Allot slot initially

# Deploy Shards

Deploy two shards (each shard contains 1*master+1*slave), on same machine(ip=1.1.1.1), start 4 Bitalostored service nodes.

Node attributes are as follows:

  • Shard 1, raft_cluster.cluster_id=1 (node 1: raft_nodehost.node_id=1, node 2: raft_nodehost.node_id=2)
  • Shard 2, raft_cluster.cluster_id=2 (node 1: raft_nodehost.node_id=1, node 2: raft_nodehost.node_id=2)

Configurations:

Shard-1, node-1

server.product_name = "bitalos-demo"
server.address = ":10000"
raft_cluster.cluster_id = 1
raft_nodehost.node_id = 1
raft_nodehost.raft_address = "1.1.1.1:10001"
raft_nodehost.init_raft_addrlist = ["1.1.1.1:10001", "1.1.1.1:10003"]
raft_nodehost.init_raft_nodelist = [1, 2]
raft_cluster.is_observer = false
raft_cluster.is_witness = false

Shard-1, node-2

server.product_name = "bitalos-demo"
server.address = ":10002"
raft_cluster.cluster_id = 1
raft_nodehost.node_id = 2
raft_nodehost.raft_address = "1.1.1.1:10003"
raft_nodehost.init_raft_addrlist = ["1.1.1.1:10001", "1.1.1.1:10003"]
raft_nodehost.init_raft_nodelist = [1, 2]
raft_cluster.is_observer = false
raft_cluster.is_witness = false

Shard-2, node-1

server.product_name = "bitalos-demo"
server.address = ":10010"
raft_cluster.cluster_id = 2
raft_nodehost.node_id = 1
raft_nodehost.raft_address = "1.1.1.1:10011"
raft_nodehost.init_raft_addrlist = ["1.1.1.1:10011", "1.1.1.1:10013"]
raft_nodehost.init_raft_nodelist = [1, 2]
raft_cluster.is_observer = false
raft_cluster.is_witness = false

Shard-2, node-2

server.product_name = "bitalos-demo"
server.address = ":10012"
raft_cluster.cluster_id = 2
raft_nodehost.node_id = 2
raft_nodehost.raft_address = "1.1.1.1:10013"
raft_nodehost.init_raft_addrlist = ["1.1.1.1:10011", "1.1.1.1:10013"]
raft_nodehost.init_raft_nodelist = [1, 2]
raft_cluster.is_observer = false
raft_cluster.is_witness = false

Guide for starting Bitalostored node: Bitalostored start

# Add Shards in Bitalosdashboard

Operate is on the page Management backend-Group. Two steps (taking shard 1 as an example):

  • Add shard 1, enter the shard id "1" as GroupId, and click the "NewGroup" button
  • Add nodes to Shard 1, select the default value or a certain value for the cloud it belongs to, select "master_slave_node" for the node type, and enter "1" for ToGroupId.
    • Add new node (shard 1-node 1), enter "1.1.1.1:10000" (server.address) in addr, and click the "AddServer" button
    • Add new node(shard 1-node 2), enter "1.1.1.1:10002" in addr, and click the "AddServer" button

Perform similar operation as above, add shard 2 and its nodes. The page will display the newly added 2-shard 4 nodes.

# Enable Nodes of Shards Accessible

To enable 4 nodes(2 shards) accessible, operation: refer to Management backend-Group, click the "ReplicaEnableAll" and "GroupSyncAll" buttons in sequence.

# Allot Slot Initially

Operate: refer to Management backend-Overview, click the "InitSlots" button.

The slots are divided equally, slots (0-511) are alloted to shard 1, slots (512-1023) alloted to shard 2.

At this point, the creation of shards is completed.

ZUOYEBANG