123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- import org.apache.hadoop.conf.Configuration;
- import org.apache.hadoop.hbase.HBaseConfiguration;
- import com.sagacloud.json.JSONObject;
- import com.zillion.database.agent.ZillionAgent;
- public class TestResetCompute {
- public static String database_name = "db_public";
- public static void main(String[] args) throws Exception {
- Configuration configuration = HBaseConfiguration.create();
- String zookeeper_connectionAddress = "zookeeper1:2181,zookeeper2:2181,zookeeper3:2181";
- int zookeeper_sessionTimeout = 300000;
- ZillionAgent agent = new ZillionAgent(configuration, zookeeper_connectionAddress, zookeeper_sessionTimeout);
- agent.Start();
- JSONObject Criteria = new JSONObject();
- JSONObject wrapperObject = new JSONObject();
- wrapperObject.put("QueryType", "delete");
- wrapperObject.put("Database", database_name);
- wrapperObject.put("Datatable", "fjd_0_computelog");
- wrapperObject.put("Criteria", Criteria);
- agent.Query(wrapperObject);
- Criteria = new JSONObject();
- wrapperObject = new JSONObject();
- wrapperObject.put("QueryType", "delete");
- wrapperObject.put("Database", database_name);
- wrapperObject.put("Datatable", "fjd_0_computedetail");
- wrapperObject.put("Criteria", Criteria);
- agent.Query(wrapperObject);
- Criteria = new JSONObject();
- wrapperObject = new JSONObject();
- wrapperObject.put("QueryType", "delete");
- wrapperObject.put("Database", database_name);
- wrapperObject.put("Datatable", "fjd_0_metercomputetime");
- wrapperObject.put("Criteria", Criteria);
- agent.Query(wrapperObject);
- Criteria = new JSONObject();
- wrapperObject = new JSONObject();
- wrapperObject.put("QueryType", "delete");
- wrapperObject.put("Database", database_name);
- wrapperObject.put("Datatable", "fjd_0_buildingcomputetime");
- wrapperObject.put("Criteria", Criteria);
- agent.Query(wrapperObject);
- JSONObject InsertObject = new JSONObject();
- InsertObject.put("building", "1101080001");
- InsertObject.put("compute_time", "20170101000000");
- InsertObject.put("first_compute_time", "20170101000000");
- wrapperObject = new JSONObject();
- wrapperObject.put("QueryType", "insert");
- wrapperObject.put("Database", database_name);
- wrapperObject.put("Datatable", "fjd_0_buildingcomputetime");
- wrapperObject.put("InsertObject", InsertObject);
- agent.Query(wrapperObject);
- agent.Stop();
- }
- }
|