tibdg Grid Generate and tibdg Table Generate

The tibdg grid generate command can be used to generate a sequence of commands that can later be executed to create a specific grid configuration. The tibdg table generate command is similar to the tibdg grid generate command except it only generates the commands required to create a single table.

When you execute the tibdg grid generate command, you are asked a series of questions regarding the design of the grid. After you have provided the necessary input values, the command generates the sequence of necessary commands to create that data grid. These commands can either be output to the console or written to a file. Then you can make any modifications to the commands and execute them either one at a time or by using the -s option to execute all the commands in a file.

tibdg Grid Generate Example

The following example shows a record using the tibdg grid generate command to generate the necessary commands to create a grid with five copysets, three nodes per copyset, three state keepers, five proxies, and two tables:
ad:install ad$ ./bin/tibdg grid generate my_grid.tibdg
Enter the number of copysets[1]: 5
Enter the number of nodes per copyset[1]: 3
Enter the number of statekeepers[1]: 3
Enter the number of proxies[1]: 5
Create a table (y|n) [y]: y
Table name: customers
Enter the name and type for column 1 in the primary index (columnName columnType): cust_id long
Create more columns to be used in the primary index (y|n) [n]: n
Create more columns (y|n) [y]: y
Enter the name and type for the column (columnName columnType): name string
Create more columns (y|n) [y]: 
Enter the name and type for the column (columnName columnType): address string
Create more columns (y|n) [y]: 
Enter the name and type for the column (columnName columnType): phone long
Create more columns (y|n) [y]: n
Create a secondary index (y|n) [n]: y
Enter index name: phone_index
Columns defined:
	1. cust_id
	2. name
	3. address
	4. phone
Select the ids of the columns in the order that is used in the index (# # #...): 4
Create another secondary index (y|n) [n]: 
Create another table (y|n) [n]: y
Table name: orders
Enter the name and type for column 1 in the primary index (columnName columnType): order_id long
Create more columns to be used in the primary index (y|n) [n]: n
Create more columns (y|n) [y]: y
Enter the name and type for the column (columnName columnType): cust_id long
Create more columns (y|n) [y]: 
Enter the name and type for the column (columnName columnType): date datetime
Create more columns (y|n) [y]: 
Enter the name and type for the column (columnName columnType): value long
Create more columns (y|n) [y]: 
Enter the name and type for the column (columnName columnType): description string
Create more columns (y|n) [y]: n
Create a secondary index (y|n) [n]: y
Enter index name: cust_index
Columns defined:
	1. order_id
	2. cust_id
	3. date
	4. value
	5. description
Select the ids of the columns in the order that is used in the index (# # #...): 2
Create another secondary index (y|n) [n]: 
Create another table (y|n) [n]: 
35 commands written to my_grid.tibdg
This example session would write the following commands to the my_grid.tibdg file:
ad:install ad$ cat my_grid.tibdg
grid create copyset_size=3
copyset create cs_01
copyset create cs_02
copyset create cs_03
copyset create cs_04
copyset create cs_05
node create --copyset cs_01 --dir ./cs_01.n_1_data cs_01.n_1
node create --copyset cs_01 --dir ./cs_01.n_2_data cs_01.n_2
node create --copyset cs_01 --dir ./cs_01.n_3_data cs_01.n_3
node create --copyset cs_02 --dir ./cs_02.n_1_data cs_02.n_1
node create --copyset cs_02 --dir ./cs_02.n_2_data cs_02.n_2
node create --copyset cs_02 --dir ./cs_02.n_3_data cs_02.n_3
node create --copyset cs_03 --dir ./cs_03.n_1_data cs_03.n_1
node create --copyset cs_03 --dir ./cs_03.n_2_data cs_03.n_2
node create --copyset cs_03 --dir ./cs_03.n_3_data cs_03.n_3
node create --copyset cs_04 --dir ./cs_04.n_1_data cs_04.n_1
node create --copyset cs_04 --dir ./cs_04.n_2_data cs_04.n_2
node create --copyset cs_04 --dir ./cs_04.n_3_data cs_04.n_3
node create --copyset cs_05 --dir ./cs_05.n_1_data cs_05.n_1
node create --copyset cs_05 --dir ./cs_05.n_2_data cs_05.n_2
node create --copyset cs_05 --dir ./cs_05.n_3_data cs_05.n_3
keeper create k_0
keeper create k_1
keeper create k_2
proxy create p_00
proxy create p_01
proxy create p_02
proxy create p_03
proxy create p_04
table create customers cust_id long
column create customers name string address string phone long
index create customers phone_index phone
table create orders order_id long
column create orders cust_id long date datetime value long description string
index create orders cust_index cust_id