Rate This Document
Findability
Accuracy
Completeness
Readability

Creating the Admin User, Storage Targets, and Chain Table

This section describes how to create the admin user, storage targets, and chain table on the Meta node.

  1. Create an admin user.
    /opt/3fs/bin/admin_cli -cfg /opt/3fs/etc/admin_cli.toml "user-add --root --admin 0 root" 

    The command output is as follows:

    # Uid                0 
    # Name               root 
    # Token              AAB7sN/h8QBs7/+B2wBQ03Lp(Expired at N/A) 
    # IsRootUser         true 
    # IsAdmin            true 
    # Gid                0

    AAB7sN/h8QBs7/+B2wBQ03Lp is the token. Save it to /opt/3fs/etc/token.txt.

  1. Install Python dependencies.
    pip3 install -r /home/3fs/deploy/data_placement/requirements.txt
  1. Create a chain table.
    cd /home 
    python3 /home/3fs/deploy/data_placement/src/model/data_placement.py -ql -relax -type CR --num_nodes 3 --replication_factor 3 --min_targets_per_disk 6

    Parameters in this command:

    • --num_nodes: number of storage nodes
    • --replication_factor: replication factor

    If the execution is successful, the output/DataPlacementModel-v_* folder is generated in the current directory, for example, /home/output/DataPlacementModel-v_3-b_6-r_6-k_3-λ_3-lb_3-ub_3.

  2. Calculate chains.
    python3 /home/3fs/deploy/data_placement/src/setup/gen_chain_table.py \
       --chain_table_type CR --node_id_begin 10001 --node_id_end 10003 \
       --num_disks_per_node 8 --num_targets_per_disk 6 \
       --target_id_prefix 1 --chain_id_prefix 9 \
       --incidence_matrix_path /home/output/DataPlacementModel-v_3-b_6-r_6-k_3-λ_3-lb_3-ub_3/incidence_matrix.pickle

    Parameters in the commands:

    • --node_id_begin: begin storage node ID
    • --node_id_end: end storage node ID
    • --num_disks_per_node: number of drives mounted to each storage node
    • -num_targets_per_disk: number of targets on each mounted drive
    • --incidence_matrix_path: path to the file generated in 3

    After the execution is successful, check whether the following files are generated in the output directory.

    -rw-r--r--  1 root root  2387 Mar  6 11:55 generated_chains.csv 
    -rw-r--r--  1 root root   488 Mar  6 11:55 generated_chain_table.csv 
    -rw-r--r--  1 root root 15984 Mar  6 11:55 remove_target_cmd.txt
  3. Create storage targets.
    /opt/3fs/bin/admin_cli --cfg /opt/3fs/etc/admin_cli.toml --config.user_info.token $(<"/opt/3fs/etc/token.txt") < /home/output/create_target_cmd.txt
  4. Upload the chains to the Mgmtd Service.
    /opt/3fs/bin/admin_cli --cfg /opt/3fs/etc/admin_cli.toml --config.user_info.token $(<"/opt/3fs/etc/token.txt") "upload-chains /home/output/generated_chains.csv"
  5. Upload the chain table to the Mgmtd Service.
    /opt/3fs/bin/admin_cli --cfg /opt/3fs/etc/admin_cli.toml --config.user_info.token $(<"/opt/3fs/etc/token.txt") "upload-chain-table --desc stage 1 /home/output/generated_chain_table.csv"
  6. List chains.
    /opt/3fs/bin/admin_cli -cfg /opt/3fs/etc/admin_cli.toml "list-chains" 

    The command output is as follows:

    # ChainId    ReferencedBy  ChainVersion  Status   PreferredOrder  Target                          Target   Target 
    # 900100001  1             1             SERVING  []              101000300101(SERVING-UPTODATE)  101000200101(SERVING-UPTODATE)  101000100101(SERVING-UPTODATE) 
    # 900100002  1             1             SERVING  []              101000300102(SERVING-UPTODATE)  101000200102(SERVING-UPTODATE)  101000100102(SERVING-UPTODATE) 
    # ...