Create a file with name tablestoreConf.json
in ${user.home}
(For windows: C:\Documents and Settings\%username%\tablestoreCong.json
, for linux /home/${username}/tablestoreCong.json
, for mac /Users/${username}/tablestoreConf.json
)
{
"endpoint": "*****",
"accessId": "*******",
"accessKey": "*************",
"instanceName": "*****"
}
Tablestore java sdk.
<dependency>
<groupId>com.aliyun.openservices</groupId>
<artifactId>tablestore</artifactId>
<version>5.3.0</version>
</dependency>
JSON parsing tool for parsing config and jsonizing java bean.
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.8</version>
</dependency>
.
└── java
└── com
└── aliyun
└── tablestore
└── example
├── BaseExample.java # Example base class
├── CleanupEnv.java # Cleanup environment
├── AggregationAndGroupBy.java # Create table & index, mock data, test aggregation & groupby :)
├── consts
│ └── ColumnConsts.java # Column names
├── model
│ └── PriceDO.java # Domain object
└── utils
├── ClientAndConfig.java # TableStore related config
└── Utils.java # Common Utils
Run the main method in class AggregationAndGroupBy
, the table & index would be created, mock data inserted, along with aggregation & groupby examples.
show the usage of aggregation
show the usage of groupby
Run the main method in class CleanupEnv
{
"endpoint": "*****",
"accessId": "*******",
"accessKey": "*************",
"instanceName": "*****",
"table": "another_table_name",
"index": "another_index_name"
}