PowerJob is a distributed task scheduling platform that supports OceanBase Database as its metadata storage backend.
This topic describes how to configure PowerJob to use OceanBase Database as the backend database and schedule various types of tasks.
Prerequisites
- Installed Java 8 or later.
- Deployed OceanBase Database 4.0 or later.
Procedure
Step 1: Download PowerJob
Run the following command to download PowerJob:
git clone https://github.com/PowerJob/PowerJob.git
Step 2: Configure the OceanBase Database connection
Create an OceanBase database and user:
-- Create the database CREATE DATABASE powerjob_db; -- Create the user CREATE USER 'powerjob'@'%' IDENTIFIED BY 'your_password'; -- Grant privileges GRANT ALL ON powerjob_db.* TO 'powerjob'@'%';In the PowerJob Server subproject, edit the daily environment configuration file
application-daily.propertiesto configure the OceanBase Database connection:# Database driver spring.datasource.core.driver-class-name=com.mysql.cj.jdbc.Driver # Database connection spring.datasource.core.jdbc-url=jdbc:mysql://your_host:2881/powerjob_db?useUnicode=true&characterEncoding=UTF-8 # Database username spring.datasource.core.username=powerjob # Database password spring.datasource.core.password=your_password # Connection pool configuration spring.datasource.core.maximum-pool-size=20 spring.datasource.core.minimum-idle=5
Step 3: Import the PowerJob project into an IDE
- Open a Java IDE such as IntelliJ IDEA or Eclipse.
- Select Import Project or Open Project, navigate to the downloaded
PowerJobdirectory, and follow the IDE wizard to complete the project import and dependency loading.
Step 4: Start PowerJob Server
- In the IDE, run the entry class
tech.powerjob.server.PowerJobServerApplication. - After startup, open a browser and go to
http://localhost:7700to access the PowerJob management console.
