1.Remove two useless ClusterConfig. 2.Adjust ClusterConfig.class and its mapping properties file, rename to ’seed_nodes’ .
This commit is contained in:
parent
7d6dc495d4
commit
bca88fb1a1
|
|
@ -41,8 +41,7 @@ public class CollectorSystem {
|
|||
final Config config = ConfigFactory.parseString("akka.remote.netty.tcp.hostname=" + ClusterConfig.Cluster.Current.hostname).
|
||||
withFallback(ConfigFactory.parseString("akka.remote.netty.tcp.port=" + ClusterConfig.Cluster.Current.port)).
|
||||
withFallback(ConfigFactory.parseString("akka.cluster.roles=" + ClusterConfig.Cluster.Current.roles)).
|
||||
withFallback(ConfigFactory.parseString("akka.actor.provider=" + ClusterConfig.Cluster.provider)).
|
||||
withFallback(ConfigFactory.parseString("akka.cluster.seed-nodes=" + ClusterConfig.Cluster.nodes)).
|
||||
withFallback(ConfigFactory.parseString("akka.cluster.seed-nodes=" + ClusterConfig.Cluster.seed_nodes)).
|
||||
withFallback(ConfigFactory.load("application.conf"));
|
||||
ActorSystem akkaSystem = ActorSystem.create("ClusterSystem", config);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
package com.a.eye.skywalking.collector.cluster;
|
||||
|
||||
import akka.actor.ActorSystem;
|
||||
|
||||
/**
|
||||
* A static class contains some config values of cluster.
|
||||
* {@link Cluster.Current#hostname} is a ip address of server which start this process.
|
||||
* {@link Cluster.Current#port} is a port of server use to bind
|
||||
* {@link Cluster.Current#roles} is a roles of workers that use to create workers which
|
||||
* has those role in this process.
|
||||
* {@link Cluster#nodes} is a nodes which cluster have.
|
||||
* {@link Cluster#appname} is a name of {@link ActorSystem} in cluster.
|
||||
* {@link Cluster#seed_nodes} is a seed_nodes which cluster have.
|
||||
*
|
||||
* @author pengys5
|
||||
*/
|
||||
|
|
@ -22,9 +19,6 @@ public class ClusterConfig {
|
|||
public static String roles = "";
|
||||
}
|
||||
|
||||
public static String nodes = "127.0.0.1:2551";
|
||||
|
||||
public static final String appname = "CollectorSystem";
|
||||
public static final String provider = "akka.cluster.ClusterActorRefProvider";
|
||||
public static String seed_nodes = "127.0.0.1:2551";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ public class ClusterConfigInitializer {
|
|||
if (!StringUtil.isEmpty(System.getProperty("cluster.current.roles"))) {
|
||||
ClusterConfig.Cluster.Current.roles = System.getProperty("cluster.current.roles");
|
||||
}
|
||||
if (!StringUtil.isEmpty(System.getProperty("cluster.nodes"))) {
|
||||
ClusterConfig.Cluster.nodes = System.getProperty("cluster.nodes");
|
||||
if (!StringUtil.isEmpty(System.getProperty("cluster.seed_nodes"))) {
|
||||
ClusterConfig.Cluster.seed_nodes = System.getProperty("cluster.seed_nodes");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.a.eye.skywalking.collector.commons.serializer;
|
||||
|
||||
import akka.serialization.JSerializer;
|
||||
import com.a.eye.skywalking.collector.CollectorSystem;
|
||||
import com.a.eye.skywalking.logging.ILog;
|
||||
import com.a.eye.skywalking.logging.LogManager;
|
||||
import com.a.eye.skywalking.trace.TraceSegment;
|
||||
|
|
@ -12,7 +11,7 @@ import com.google.protobuf.InvalidProtocolBufferException;
|
|||
* @author pengys5
|
||||
*/
|
||||
public class TraceSegmentSerializer extends JSerializer {
|
||||
private static ILog logger = LogManager.getLogger(CollectorSystem.class);
|
||||
private static ILog logger = LogManager.getLogger(TraceSegmentSerializer.class);
|
||||
|
||||
@Override
|
||||
public boolean includeManifest() {
|
||||
|
|
|
|||
|
|
@ -26,8 +26,7 @@ public class CollectorBootStartUp {
|
|||
final Config config = ConfigFactory.parseString("akka.remote.netty.tcp.hostname=" + ClusterConfig.Cluster.Current.hostname).
|
||||
withFallback(ConfigFactory.parseString("akka.remote.netty.tcp.port=" + ClusterConfig.Cluster.Current.port)).
|
||||
withFallback(ConfigFactory.parseString("akka.cluster.roles=" + ClusterConfig.Cluster.Current.roles)).
|
||||
withFallback(ConfigFactory.parseString("akka.actor.provider=" + ClusterConfig.Cluster.provider)).
|
||||
withFallback(ConfigFactory.parseString("akka.cluster.seed-nodes=" + ClusterConfig.Cluster.nodes)).
|
||||
withFallback(ConfigFactory.parseString("akka.cluster.seed-nodes=" + ClusterConfig.Cluster.seed_nodes)).
|
||||
withFallback(ConfigFactory.load("application.conf"));
|
||||
|
||||
// ActorSystem system = ActorSystem.create(ClusterConfig.Cluster.appname, config);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
cluster.current.hostname=127.0.0.1
|
||||
cluster.current.port=1000
|
||||
cluster.current.roles=[WorkersListener, TraceSegmentReceiver, NodeInstancePersistence]
|
||||
cluster.nodes=["akka.tcp://CollectorSystem@127.0.0.1:1000", "akka.tcp://CollectorSystem@127.0.0.1:1001", "akka.tcp://CollectorSystem@127.0.0.1:1002"]
|
||||
cluster.seed_nodes=["akka.tcp://CollectorSystem@127.0.0.1:1000", "akka.tcp://CollectorSystem@127.0.0.1:1001", "akka.tcp://CollectorSystem@127.0.0.1:1002"]
|
||||
|
|
|
|||
|
|
@ -28,11 +28,9 @@ public class StartUpTestCase {
|
|||
final Config config = ConfigFactory.parseString("akka.remote.netty.tcp.hostname=" + ClusterConfig.Cluster.Current.hostname).
|
||||
withFallback(ConfigFactory.parseString("akka.remote.netty.tcp.port=" + ClusterConfig.Cluster.Current.port)).
|
||||
withFallback(ConfigFactory.parseString("akka.cluster.roles=" + ClusterConfig.Cluster.Current.roles)).
|
||||
withFallback(ConfigFactory.parseString("akka.actor.provider=" + ClusterConfig.Cluster.provider)).
|
||||
withFallback(ConfigFactory.parseString("akka.cluster.seed-nodes=" + ClusterConfig.Cluster.nodes)).
|
||||
withFallback(ConfigFactory.parseString("akka.cluster.seed-nodes=" + ClusterConfig.Cluster.seed_nodes)).
|
||||
withFallback(ConfigFactory.load("application.conf"));
|
||||
ActorSystem system = ActorSystem.create(ClusterConfig.Cluster.appname, config);
|
||||
// WorkersCreator.INSTANCE.boot(system);
|
||||
ActorSystem system = ActorSystem.create("CollectorSystem", config);
|
||||
|
||||
EsClient.boot();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue