提交 d0059dff 编写于 作者: S Shuduo Sang

fix hard code server ip in opentsdb test program.

[TD-1042]
上级 ad41a5ad
...@@ -206,16 +206,6 @@ ...@@ -206,16 +206,6 @@
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
<version>1.7.25</version> <version>1.7.25</version>
</dependency> </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>1.7.7</version>
</dependency>
<dependency> <dependency>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
......
import com.stumbleupon.async.Callback; import com.stumbleupon.async.Callback;
import com.stumbleupon.async.Deferred; import com.stumbleupon.async.Deferred;
import lombok.extern.slf4j.Slf4j;
import net.opentsdb.core.TSDB; import net.opentsdb.core.TSDB;
import net.opentsdb.uid.NoSuchUniqueName; import net.opentsdb.uid.NoSuchUniqueName;
...@@ -40,13 +39,19 @@ import java.util.concurrent.*; ...@@ -40,13 +39,19 @@ import java.util.concurrent.*;
import java.math.*; import java.math.*;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import org.apache.log4j.Logger;
import org.apache.log4j.LogManager;
import org.apache.log4j.Level;
public class OpentsdbTest{
public class OpentsdbTest{
//static { System.setProperty("logback.configurationFile", "/home/ubuntu/fang/opentsdb/opentsdbtest/logback.xml");} //static { System.setProperty("logback.configurationFile", "/home/ubuntu/fang/opentsdb/opentsdbtest/logback.xml");}
static { System.setProperty("logback.configurationFile", "/etc/opentsdb/logback.xml");} static { System.setProperty("logback.configurationFile", "/etc/opentsdb/logback.xml");}
public static void main(String args[]) { public static void main(String args[]) {
Logger logger = LogManager.getLogger(OpentsdbTest.class);
logger.setLevel(Level.OFF);
// begin to parse argument // begin to parse argument
String datadir = "/home/ubuntu/testdata"; String datadir = "/home/ubuntu/testdata";
String sqlchoice = "q1"; String sqlchoice = "q1";
...@@ -156,7 +161,7 @@ public class OpentsdbTest{ ...@@ -156,7 +161,7 @@ public class OpentsdbTest{
} }
switch (sqlchoice) { switch (sqlchoice) {
case "q1": case "q1":
get_url = "http://192.168.1.114:4242/api/query?"; get_url = "http://127.0.0.1:4242/api/query?";
/* /*
get_url = get_url + "start=1563249700&m=none:temperature{devgroup="; get_url = get_url + "start=1563249700&m=none:temperature{devgroup=";
get_url = get_url + String.valueOf(ig-10) +"}"; get_url = get_url + String.valueOf(ig-10) +"}";
......
import com.stumbleupon.async.Callback; import com.stumbleupon.async.Callback;
import com.stumbleupon.async.Deferred; import com.stumbleupon.async.Deferred;
import lombok.extern.slf4j.Slf4j;
import net.opentsdb.core.TSDB; import net.opentsdb.core.TSDB;
import net.opentsdb.uid.NoSuchUniqueName; import net.opentsdb.uid.NoSuchUniqueName;
...@@ -64,7 +63,7 @@ public class WriteThread extends Thread { ...@@ -64,7 +63,7 @@ public class WriteThread extends Thread {
public void run() { public void run() {
StringEntity stringEntity; StringEntity stringEntity;
String port = "4242"; String port = "4242";
String put_url = "http://192.168.1.114:"+port+"/api/put?summary"; String put_url = "http://127.0.0.1:"+port+"/api/put?summary";
try (CloseableHttpClient httpclient = HttpClients.createDefault()) { try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
/* /*
httpclient.getHttpConnectionManager().getParams() httpclient.getHttpConnectionManager().getParams()
...@@ -152,4 +151,4 @@ public class WriteThread extends Thread { ...@@ -152,4 +151,4 @@ public class WriteThread extends Thread {
System.out.println("failed to connect"); System.out.println("failed to connect");
} }
}//end run }//end run
}//end class }//end class
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册