Saturn Console deployment
This section will introduce how to install and deploy Saturn Console from scratch.
1 Preparation before deployment
1.1 Hardware preparation
At least one Linux server, the number of servers depends on the planned Saturn Console cluster and the size of the ZK cluster.
1.2 Software preparation
JDK : 1.7+
ZooKeeper: 3.4.6+ (ZooKeeper 3.4.6 is recommended ( download link from official website ), higher versions are not verified)
nodejs: 7.8.0+
2 Start deployment
2.1 Install ZooKeeper
Follow the official documentation to install.
For a production environment, it is recommended to use a cluster of 5 servers (1 Leader + 4 Follower).
Refer to here for recommended ZooKeeper configuration .
2.2 Install MySQL
Currently Saturn supports 2 databases: MySQL and H2. H2 is mainly used for testing, and MySQL is recommended for production environments. MySQL is mainly used to store job configuration and configuration history, system configuration, and namespace and zk cluster information, etc.
Regarding the version of MySQL, there are no requirements.
Install MySQL, follow MySQL's official documentation for no instructions here.
2.3 Data preparation
The following operation is for MySQL, and a similar approach can be imitated for H2.
2.3.1 database creation
The name of the database can be specified by yourself. Here is an example:
CREATE DATABASE saturn CHARACTER SET utf8 COLLATE utf8_general_ci;
2.3.2 schema creation
Get the latest schema.sql from here . If you want to get other versions of the schema, you can get them on other tags in the source code.
Execute schema.sql.
2.4 Install Console
2.4.1 Download
Click on the latest version of "Console Zip File" from https://github.com/vipshop/Saturn/releases , download saturn-console-{version}-exec.jar, and place it in a suitable directory.
This tutorial uses 3.x as an example.
2.4.2 Start Console
nohup java -DSATURN_CONSOLE_DB_URL=jdbc:mysql://localhost:3306/saturn -DSATURN_CONSOLE_DB_USERNAME=your_username -DSATURN_CONSOLE_DB_PASSWORD=your_password -jar saturn-console-{
version}-exec.jar &
Visit http://{ip}:9088 to see the saturn console. Where ip refers to the IP of the machine where the console is installed.
The log will be output to the path /apps/logs/saturn_console/saturn.console.log
2.4.2.1 JVM parameter recommendation
Note that if you start the console in a production environment, it is recommended to add some JVM startup parameters:
JDK 1.7:
-Xmx2G -Xms2G -XX:PermSize=256m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=75 -XX:+ExplicitGCInvokesConcurrent -Xloggc:${HOME}/gc_zk.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:ErrorFile=${HOME}/hs_err_%p.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${HOME}
JDK 1.8:
-Xmx2G -Xms2G -XX:MetaspaceSize=256m -MaxMetaspaceSize=512m -XX:+UseConcMarkSweepGC -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=75 -XX:+ExplicitGCInvokesConcurrent -Xloggc:${HOME}/gc_zk.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:ErrorFile=${HOME}/hs_err_%p.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${HOME}
2.4.2.2 Description of startup parameters
parameter name | Whether to support environment variables/JVM parameters | description | Do you have to |
---|---|---|---|
VIP_SATURN_CONSOLE_CLUSTER | All support | Console cluster id | N |
SATURN_CONSOLE_DB_URL | All support | DB connection url | AND |
SATURN_CONSOLE_DB_USERNAME | All support | DB user name | AND |
SATURN_CONSOLE_DB_PASSWORD | All support | password | AND |
saturn.console.log | JVM parameters (-D) | Log directory. The default is /apps/logs/saturn_console | N |
VIP_SATURN_DASHBOARD_REFRESH_INTERVAL_MINUTE | All support | Dashboard background refresh frequency, in minutes. The default value is 1. | N |
server.port | JVM parameters (-D) | Start port, default 9088 | N |
authentication.enabled | JVM parameters (-D) | Whether to enable user authentication. The default is false. See the section on authentication and authorization for details | N |
authorization.enabled.default | JVM parameters (-D) | Whether to enable user authentication by default. The default is false. See the section on authentication and authorization for details | N |
VIP_SATURN_DASHBOARD_NOT_RUNNING_WARN_DELAY_MS_WHEN_JOB_RUNNING | All support | The job not running alarm delay when the job is running, in milliseconds. The default value is 2 hours. | N |
Use your browser to visit http://localhost:9088 to see your Saturn Console!
2.4.3 Create ZK Cluster
Executor will obtain the job information of the corresponding domain from ZK, and report the running status of the job to ZK. And one Console (cluster) can manage multiple ZK clusters. The following will introduce how to add a zk cluster in the Console. Suppose the id of the zk cluster we want to add is test.
2.4.3.1 Bind console and zk cluster in system configuration
In CONSOLE_ZK_CLUSTER_MAPPING under "System Configuration", bind the console and zk cluster, the format is {console_id}:{zk_cluster_id}. If VIP_SATURN_CONSOLE_CLUSTER is not specified for console startup, default is used.
2.4.3.2 Create zk cluster
Click "Registration Center Menu" and click the "Add Cluster" button in the "ZK Cluster Management" submenu. Enter ZK information as follows:
After adding, you will see zk online.
Note: The cluster ID must be in English, not Chinese or special symbols
2.4.4 Create Domain
The domain is the management unit of multiple jobs. The domain is bound to the zk cluster, and the two are in a many-to-one relationship. A domain belongs to only one zk cluster.
On the "Domain Management" page of the registration center, add a domain (namespace) and bind it to the zk cluster.
After creating the domain, the next chapter will tell you how to create a Java job.
2.5 About Console cluster deployment
In order to achieve the high availability of the Console, we all hope that the Console consists of multiple servers. We only need to specify the same VIP_SATURN_CONSOLE_CLUSTER in the environment variables of multiple different servers. As for the value of VIP_SATURN_CONSOLE_CLUSTER, you can specify it by yourself, just a cluster identifier.