OTSClient is the client for Tablestore. OTSClient provides a series of methods for you to manage tables and perform read and write operations on one or more rows. To use Tablestore SDK for PHP to initiate a request, you must initialize an OTSClient instance and modify the default configuration items of OTSClientConfig.
Obtain an endpoint
An endpoint is the domain name used to access a Tablestore instance in a region. The following table lists the examples of endpoints in the supported format.
Example | Description |
---|---|
http://sun.cn-hangzhou.ots.aliyuncs.com | The public endpoint used to access the sun instance in the China (Hangzhou) region over HTTP. |
https://sun.cn-hangzhou.ots.aliyuncs.com | The public endpoint used to access the sun instance in the China (Hangzhou) region over HTTPS. |
To query the endpoints of your Tablestore instance, perform the following operations:
Configure an AccessKey pair
To access Tablestore, you must have an AccessKey pair that consists of an AccessKey ID and AccessKey secret to verify your identity. The following types of AccessKey pairs are supported:
- The AccessKey pair of an Alibaba Cloud account. To obtain the AccessKey pair of an
Alibaba Cloud account, take the following steps:
- On the Alibaba Cloud official website,Create Your Alibaba Cloud Account.
- Create an AccessKey ID and an AccessKey secret. For more information, see Obtain an AccessKey pair.
- The AccessKey pair of a RAM user who is granted with permissions to access Tablestore.
To obtain the AccessKey pair of a RAM user, take the following steps:
- Use your Alibaba Cloud account to log on to RAM. Create a RAM user or use an existing RAM user.
- Use your Alibaba Cloud account to authorize the RAM user to access Tablestore.
- After the RAM user is authorized, you can use the AccessKey pair of the RAM user to access Tablestore.
- Temporary access credentials obtained from STS. To obtain temporary access credentials
from STS, take the following steps:
- The application server uses RAM or STS to obtain access credentials that consist of a temporary AccessKey ID, an AccessKey secret, and a token. After the access credentials are obtained, the application server sends them to you.
- You can use the received access credentials to access Tablestore.
Initialize an OTSClient instance
After you obtain the AccessKey ID and AccessKey secret, you can perform the following operations to initialize an OTSClient instance:
HTTPS
Install the OpenSSL PHP extension.