Create client
Updated at:
Copy as MD
HiTSDB is the main client class in the TSDB SDK. It is thread-safe, so you can safely share a single instance across multiple threads in your application.
Prerequisites
Before you begin, ensure that you have:
Read Terms to familiarize yourself with TSDB concepts
Read HTTP API Reference to understand API usage
Your TSDB instance domain and port (available in the TSDB console)
Create a client
Creating an HiTSDB client requires two classes:
| Class | Role |
|---|---|
HiTSDBConfig | Fundamental class of the TSDB client. |
HiTSDBClientFactory | Factory class. Produces HiTSDB client instances from a config. |
Before creating a TSDB object, create an HiTSDBConfig object first.Use the following steps:
// Step 1: Build the config
// Replace example.hitsdb.com and 8242 with your actual domain and port.
// Find your domain and port in the HiTSDB console.
// tsdbuser and password are the username and password used for user authentication. Create TSDB users in the instance management console.
// If user authentication is not enabled for your instance, do not call basicAuth() when you create the config object.
HiTSDBConfig config = HiTSDBConfig.address("example.hitsdb.com", 8242).basicAuth("tsdbuser", "password").config();
// Step 2: Create the client
HiTSDB tsdb = HiTSDBClientFactory.connect(config);The tsdb object is ready for read, put, and other operations.
What's next
Terms — core concepts for working with time series data
HTTP API Reference — API details for read and put operations
Is this page helpful?