1. Overview

Sensors Analytics introduced the " .Multi-Project v1.13" feature in version 1.5. This article introduces how to use the multiple project management tool.

The multiple project management tool provides the following functions:

  1. List all projects
  2. Create a new project
  3. Update project display name
  4. Delete project
  5. Recover resources of deleted projects
  6. Reset password for logging into the system

In addition:

  • For information about the project reset feature, see .Multi-Project v1.13.
  • For operations related to the cloud version of multiple projects, please contact the on-duty colleagues for assistance.

2. Instructions

Please use this tool under the sa_cluster account. Switch from root to the sa_cluster account as follows:

su - sa_cluster
BASH
  • Please note the hyphen between "su" and "sa_cluster".

2.1. List all projects

To list all projects, execute the following command:

project_tools -m list
BASH
spadmin project -m list
BASH
sbpadmin project show
BASH

An example of the running output is as follows:

-------------------------------------- project.id: 1 name: default cname: 默认项目 status: AVAILABLE super_token: FFNJ24C31 normal_token: 8FWI1GN1F create_time: 2016-06-29 23:46:39.0 -------------------------------------- 当前共 1 个有效 project. 许可允许最多使用 2 个项目.
CODE

There are 3 values ​​of the status, which mean:

  • CREATED: Already created, cannot import data, usually appears within the first minute after creating the project, and then becomes PREPARED;
  • PREPARED: Can import, but cannot query, this status usually appears when a new project is created and data is not imported;
  • AVAILABLE: Can query, that is, behavioral event data has been imported;

2.2. Create a new project

The following command can be used to create a new project:

project_tools -m create -n <项目名称> [-c <项目显示名>] -p <新项目admin的密码> [--normal_token <数据导入 Normal Token>] [--super_token <数据导入 Super Token>]
BASH
spadmin project -m create -n <项目名称> [-c <项目显示名>] -p <新项目admin的密码> [--normal_token <数据导入 Normal Token>] [--super_token <数据导入 Super Token>] [--disable_schema_limited]
BASH
sbpadmin project create -n <项目名称> [-c <项目显示名>] -p <新项目admin的密码> [--normal_token <数据导入 Normal Token>] [--super_token <数据导入 Super Token>] [--disable-schema-limited]
BASH

Starting from version 1.17, the data strong verification mode is enabled by default when creating a new project. To disable it, refer to the command in the lower part Updating project configuration. For more information about the data strong verification mode, refer to the documentation Data Strong Verification Mode

Parameter explanations:

  • -n, --name: Project name, which needs to be a valid variable name, consisting of English letters (uppercase and lowercase), numbers, and underscores. The first character cannot be a number;
  • -p, --password: Password for the admin account of the new project;
  • -c, --cname: Project display name, which can be a Chinese name and is used for interface display. This parameter is optional. If not entered, the project display name is the same as the project name;
  • --normal_token: Added in version 1.6, the Normal Token of the project. This parameter is optional. If not set, the value is empty;
  • --super_token: Added in version 1.6, the Super Token of the project. This parameter is optional. If not set, the value is empty;
  • --disable_schema_limited Close the data strong verification mode (supported from version 1.17).
  • --disable-schema-limited Close the data strong verification mode (Please use this configuration for SBP 1.3.0+).

Example:

project_tools -m create -n my_project -c 我的项目 -p PasswordTest123 
BASH
spadmin project -m create -n my_project -c 我的项目 -p PasswordTest123 --disable_schema_limited
BASH
sbpadmin project create -n my_project -c 我的项目 -p PasswordTest123 --disable-schema-limited
BASH


To create a new project named "my_project" with the display name "我的项目" and use the account "admin" with the password "PasswordTest123" for logging in.

After creating this account, you can log in to the corresponding project using this account and then create accounts and assign permissions on the interface.

  • If the number of current projects has reached the maximum allowed by the license, you will not be able to create a new project. You can delete projects or change the license before creating a new project.

2.3. Update Project Configuration

Execute the following command to update the project configuration:

project_tools -m update -n <项目名称> [-c <项目显示名>] [--normal_token <数据导入 Normal Token>] [--super_token <数据导入 Super Token>] [--clear_normal_token] [--clear_super_token]
BASH
spadmin project -m update -n <项目名称> [-c <项目显示名>] [--normal_token <数据导入 Normal Token>] [--super_token <数据导入 Super Token>] [--clear_normal_token] [--clear_super_token] [--disable_schema_limited]
BASH
sbpadmin project update -n <项目名称> [-c <项目显示名>] [--normal_token <数据导入 Normal Token>] [--super_token <数据导入 Super Token>] [--clear_normal_token] [--clear_super_token] [--disable-schema-limited]
BASH

Parameter Explanation:

  • -n, --name: The name of the project to modify the configuration;
  • -c, --cname: Set the display name of the project, optional;
  • --normal_token: New configuration item in version 1.6, set the Normal Token of the project, optional;
  • --super_token: New configuration item in version 1.6, set the Super Token of the project, optional;
  • --clear_normal_token: New configuration item in version 1.6, set the Normal Token to empty value, optional;
  • --clear_super_token: New configuration item in version 1.6, set the Super Token to empty value, optional;
  • --enable_schema_limited Enable data strong validation mode (supported from version 1.17)
  • --disable_schema_limited Disable the data schema validation mode (supported from version 1.17)
  • --disable-schema-limited Disable the data schema validation mode (please use this configuration for SBP 1.3.0+ version).

Example:

project_tools -m update -n my_project -c 新的项目
BASH
spadmin project -m update -n my_project -c 新的项目 --disable_schema_limited
BASH
sbpadmin project update -n my_project -c 新的项目 --disable-schema-limited
BASH

2.4. Delete project

The following command can be used to delete a project:

project_tools -m delete -n <项目名称>
BASH
spadmin project -m delete -n <项目名称>
BASH
sbpadmin project delete -n <项目名称>
BASH

Parameter explanation:

  • -n, --name: The name of the project to be deleted;

Example:

project_tools -m delete -n my_project
BASH
spadmin project -m delete -n my_project
BASH
sbpadmin project delete -n my_project
BASH
  • Please note: Once the project is deleted, it cannot be recovered. Please proceed with caution!
  • The default project default cannot be deleted, but it can be reset. For information about the reset function, please refer to Multiple Projects.

2.5. Reclaim resources of deleted projects

To recycle resources of deleted projects, execute the following command:

project_tools -m purge
BASH
spadmin project -m purge
BASH
sbpadmin project purge
BASH
  • Please note that this operation takes a long time, please be patient! It is recommended to start the "screen" job before performing the above operation to avoid terminal disconnection due to long execution time, which may cause the above command to fail. The "screen" job can be started with the following command: screen -S job_name, for example: screen -S sensorsdata
  • In sbp 1.4.0 version, the project purge tool has been improved with more information, making the purge process more visual

2.6. User tools

Use this tool to reset the admin password:

sbpadmin account -u admin -P PASSWORD -p default -r analyst
CODE
spadmin account -u admin -P PASSWORD -p default -r analyst
CODE
user_tools -username admin -password PASSWORD -project default
CODE
  • SBP 0.5+ &amp; Sensors Analytics version &gt;= 1.14 Parameter explanation:
    • -u: Specify the username (must be in email format), required;
    • -P: Specify the user password (must be a combination of 8 to 30 letters, numbers, and symbols), required;
    • -p: Specify the project name in English, required;
    • -r: Specify the role name in English. Modifying the password is not required but creating a new user is required. There are three default roles: admin (administrator), analyst, and guest. If you want to specify a custom role, please contact the on-duty colleague for processing.
    • -g: Specify whether it is a platform account. The default is false (only applicable to 1.15)

Example:

  • Update the admin account password

Update the password of the admin account to 123+++qwe

sbpadmin account --username admin --password 123+++qwe -p default
CODE
  • Update the password of the platform account

Update the password of the platform account with the account name "1@xx.com" under the default project to 123+++qwe

sbpadmin account -u 1@xx.com -P 123+++qwe -p default -g true
CODE
  • Update the password of the project account

Update the password of the project account with the account name "1@xx.com" under the default project to 123+++qwe

sbpadmin account -u 1@xx.com -P 123+++qwe -p default -g false
CODE
  • Create a platform account and bind a role (use with caution, please perform the operation on the page)

Create an account with the account name "2@xx.com", password 123+++qwe, and role admin under the default project

sbpadmin account -u 2@xx.com -P 123+++qwe -p default -r admin -g true
CODE
  • Create a project account and bind a role (use with caution, please perform the operation on the page)

Create an account with the account name "2@xx.com", password 123+++qwe, and role admin under the default project

sbpadmin account -u 2@xx.com -P 123+++qwe -p default -r admin -g false
CODE


  • Explanation of parameters for SensPower Analytics version &lt; 1.14:
    • -username: Specify the username (no restrictions). If the specified user does not exist, create one with admin permissions;
    • -password: Specify the user password (no restrictions);
    • -project: Specify the project name in English;