jxing2 6 سال پیش
والد
کامیت
075cda84a2

+ 1 - 0
.gitignore

@@ -8,6 +8,7 @@
 *.jar
 *.war
 *.ear
+*.iml
 
 # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
 hs_err_pid*

+ 157 - 0
repairInfoTable/pom.xml

@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>com.sagacloud</groupId>
+  <artifactId>repairInfoTable</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <name>repairInfoTable</name>
+  <!-- FIXME change it to the project's website -->
+  <url>http://www.example.com</url>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <maven.compiler.source>1.7</maven.compiler.source>
+    <maven.compiler.target>1.7</maven.compiler.target>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.11</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.sagacloud</groupId>
+      <artifactId>zillion-util</artifactId>
+      <version>1.8.2</version>
+      <type>jar</type>
+      <exclusions>
+        <exclusion>
+          <groupId>com.google.guava</groupId>
+          <artifactId>guava</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>com.sun.jersey</groupId>
+          <artifactId>jersey-server</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>com.sun.jersey</groupId>
+          <artifactId>jersey-core</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.httpcomponents</groupId>
+          <artifactId>httpclient</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.httpcomponents</groupId>
+          <artifactId>httpcore</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>com.sagacloud</groupId>
+      <artifactId>json-lib-zillion</artifactId>
+      <version>1.0</version>
+      <type>jar</type>
+      <exclusions>
+        <exclusion>
+          <groupId>com.google.guava</groupId>
+          <artifactId>guava</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hbase</groupId>
+      <artifactId>hbase-server</artifactId>
+      <version>1.3.0</version>
+      <exclusions>
+        <exclusion>
+          <groupId>com.sun.jersey</groupId>
+          <artifactId>jersey-server</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>com.sun.jersey</groupId>
+          <artifactId>jersey-core</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>com.sun.jersey</groupId>
+          <artifactId>jersey-json</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>com.google.guava</groupId>
+          <artifactId>guava</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.httpcomponents</groupId>
+          <artifactId>httpclient</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.httpcomponents</groupId>
+          <artifactId>httpcore</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hbase</groupId>
+      <artifactId>hbase-client</artifactId>
+      <version>1.3.0</version>
+      <exclusions>
+        <exclusion>
+          <groupId>com.google.guava</groupId>
+          <artifactId>guava</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
+      <plugins>
+        <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
+        <plugin>
+          <artifactId>maven-clean-plugin</artifactId>
+          <version>3.1.0</version>
+        </plugin>
+        <!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
+        <plugin>
+          <artifactId>maven-resources-plugin</artifactId>
+          <version>3.0.2</version>
+        </plugin>
+        <plugin>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>3.8.0</version>
+        </plugin>
+        <plugin>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <version>2.22.1</version>
+        </plugin>
+        <plugin>
+          <artifactId>maven-jar-plugin</artifactId>
+          <version>3.0.2</version>
+        </plugin>
+        <plugin>
+          <artifactId>maven-install-plugin</artifactId>
+          <version>2.5.2</version>
+        </plugin>
+        <plugin>
+          <artifactId>maven-deploy-plugin</artifactId>
+          <version>2.8.2</version>
+        </plugin>
+        <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
+        <plugin>
+          <artifactId>maven-site-plugin</artifactId>
+          <version>3.7.1</version>
+        </plugin>
+        <plugin>
+          <artifactId>maven-project-info-reports-plugin</artifactId>
+          <version>3.0.0</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>

+ 38 - 0
repairInfoTable/src/main/java/com/sagacloud/Config.java

@@ -0,0 +1,38 @@
+package com.sagacloud;
+/*
+ * Author: Jxing
+ * Create Time: 2019/3/12
+ */
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class Config {
+    private static Logger log = LoggerFactory.getLogger(Config.class);
+    private static Map<String, String> configMap = new ConcurrentHashMap<>();
+    private static Properties prop = null;
+    public static String getProperty(String key){
+        if(!configMap.containsKey(key)) {
+            synchronized (Config.class) {
+                try {
+                    if (prop == null) {
+                        prop = new Properties();
+                        prop.load(Config.class.getClassLoader().getResourceAsStream("config.properties"));
+                    }
+                    if (!configMap.containsKey(key)) {
+                        configMap.put(key, prop.getProperty(key));
+                    }
+                } catch (IOException e) {
+                    e.printStackTrace();
+                    log.error("Load properties failed.");
+                }
+            }
+        }
+        return configMap.get(key);
+    }
+}

+ 13 - 0
repairInfoTable/src/main/java/com/sagacloud/RepairTable.java

@@ -0,0 +1,13 @@
+package com.sagacloud;
+/*
+ * Author: Jxing
+ * Create Time: 2019/3/12
+ */
+import com.zillion.database.agent.ZillionAgent;
+public class RepairTable {
+
+    public static void main(String[] args) {
+        ZillionAgent agent = ZillionAgentProvider.GetAgent();
+
+    }
+}

+ 32 - 0
repairInfoTable/src/main/java/com/sagacloud/ZillionAgentProvider.java

@@ -0,0 +1,32 @@
+package com.sagacloud;
+/*
+ * Author: Jxing
+ * Create Time: 2019/3/12
+ */
+import com.zillion.database.agent.ZillionAgent;
+import org.apache.hadoop.conf.Configuration;
+
+public class ZillionAgentProvider {
+    private volatile static ZillionAgent agent;
+
+    public static ZillionAgent GetAgent() {
+        if (agent == null) {
+            synchronized (ZillionAgentProvider.class) {
+                if (agent == null) {
+                    try {
+                        // Configuration configuration = HBaseConfiguration.create();
+                        Configuration configuration = new Configuration();
+                        configuration.set("hbase.cluster.distributed", "true");
+                        //configuration.set("hbase.zookeeper.quorum", "zookeeper1,zookeeper2,zookeeper3");
+                        configuration.set("hbase.zookeeper.quorum", Config.getProperty("hbase.zookeeper.quorum"));
+                        agent = new ZillionAgent(configuration,"data-platform-3");
+                        agent.Start();
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+            }
+        }
+        return agent;
+    }
+}

+ 1 - 0
repairInfoTable/src/main/resources/config.properties

@@ -0,0 +1 @@
+hbase.zookeeper.quorum=zookeeper1.saga