Ehcache Jgroups replication using TCP - java

I am trying to setup a replicated cache using Jgroups in Ehcache.I am having problems in clustering the cache.I created 2 projects in eclipse each refering to different ehcache.xml configuration file.
Both the configuration files are identical and is given beolw.
<?xml version="1.0"?>
<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory"
properties="connect=TCP(bind_port=7800):
TCPPING(initial_hosts=localhost[7800],localhost[7801];port_range=10;timeout=3000;
num_initial_members=3):
VERIFY_SUSPECT(timeout=1500):
pbcast.NAKACK(retransmit_timeout=3000):
pbcast.GMS(join_timeout=50000;print_local_addr=true)"
propertySeparator="::" />
<cache name="sampleCache"
maxElementsInMemory="1000000"
eternal="true"
overflowToDisk="false">
<cacheEventListenerFactory
class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
properties="replicateAsynchronously=true"/>
</cache>
I am using the following jar files in my classpath.
-ehcache-2.9.0.jar
-ehcache-jgroupsreplication-1.7.jar
-jgroups-3.6.0.Final.jar
-log4j-1.2.16
When I run the programs project1 shows
63511 [main] DEBUG org.jgroups.protocols.pbcast.NAKACK -
[SBSPBWSVM110-42986 setDigest()]
existing digest: []
new digest: SBSPBWSVM110-42986: [0 (0)]
resulting digest: SBSPBWSVM110-42986: [0 (0)]
63511 [main] DEBUG org.jgroups.protocols.pbcast.GMS - SBSPBWSVM110-42986: installing view [SBSPBWSVM110-42986|0] (1) [SBSPBWSVM110-42986]
63543 [main] DEBUG org.jgroups.protocols.pbcast.GMS - SBSPBWSVM110-42986: created cluster (first member). My view is [SBSPBWSVM110-42986|0], impl is org.jgroups.protocols.pbcast.CoordGmsImpl
Jan 09, 2015 11:49:51 AM net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProvider init
INFO:JGroups Replication started for 'EH_CACHE'. JChannel: local_addr=SBSPBWSVM110-42986
cluster_name=EH_CACHE
my_view=[SBSPBWSVM110-42986|0] (1) [SBSPBWSVM110-42986]
state=CONNECTED
discard_own_messages=true
state_transfer_supported=false
When I run the programs project2 shows
63451 [main] DEBUG org.jgroups.protocols.pbcast.NAKACK -
[SBSPBWSVM110-20554 setDigest()]
existing digest: []
new digest: SBSPBWSVM110-20554: [0 (0)]
resulting digest: SBSPBWSVM110-20554: [0 (0)]
63451 [main] DEBUG org.jgroups.protocols.pbcast.GMS - SBSPBWSVM110-20554: installing view [SBSPBWSVM110-20554|0] (1) [SBSPBWSVM110-20554]
63452 [main] DEBUG org.jgroups.protocols.pbcast.GMS - SBSPBWSVM110-20554: created cluster (first member). My view is [SBSPBWSVM110-20554|0], impl is org.jgroups.protocols.pbcast.CoordGmsImpl
Jan 09, 2015 11:49:51 AM net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProvider init
INFO: JGroups Replication started for 'EH_CACHE'. JChannel: local_addr=SBSPBWSVM110-20554
cluster_name=EH_CACHE
my_view=[SBSPBWSVM110-20554|0] (1) [SBSPBWSVM110-20554]
state=CONNECTED
discard_own_messages=true
state_transfer_supported=false
But the replication simply isnt happening.I have done the RMIreplication using Ehcache and following the same approach here also. So I am assuming nothing is wrong in my java code.
I am unable to find the issue here.Is my configuration wrong??Please help me with this issue..

The config you use is strange: it's mising some protocols. Can't ehcache refer to a JGroups config file, e.g. udp.xml ?
Also you you set bind_addr in TCP or use -Djgroups.bind_addr=1.2.3.4 where 1.2.3.4 is the network interface.
Then, in TCPPING.initial_hosts, you'll need to list all the members with the bind addresses you used above, e.g. 1.2.3.4[7800],5.6.7.8[7800] etc.

Related

Trying to use TCPPING for JGroups in a Infinispan env fail as address is Transport.getAddress() is null

I am trying to setup a replicated Infinispan embedded cache.
When using the demo code for programatically setup the cache, everything works, as expected (https://github.com/infinispan/infinispan-simple-tutorials/tree/main/infinispan-embedded/cache-replicated)
Now, I want to configure it to use a defined list of initial hosts.
So, I changed slightly the code to be :
public class TestGenerate
{
public static void main(String[] args) throws InterruptedException
{
// Setup up a clustered cache manager
GlobalConfigurationBuilder global = GlobalConfigurationBuilder.defaultClusteredBuilder();
GlobalConfiguration globalConfiguration = global.transport().defaultTransport().addProperty("configurationFile", "jgroups.xml").build();
// Initialize the cache manager
DefaultCacheManager cacheManager = new DefaultCacheManager(globalConfiguration);
// Create a replicated synchronous configuration
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.clustering().cacheMode(CacheMode.REPL_SYNC);
Configuration cacheConfig = builder.build();
// Create a cache
Cache<String, String> cache = cacheManager.administration()
.withFlags(CacheContainerAdmin.AdminFlag.VOLATILE)
.getOrCreateCache("cache", cacheConfig);
// Store the current node address in some random keys
for(int i=0; i < 10; i++) {
cache.put(UUID.randomUUID().toString(), cacheManager.getNodeAddress());
}
// Display the current cache contents for the whole cluster
System.out.println("--------------- whole cluster");
cache.entrySet().forEach(entry -> System.out.printf("%s = %s\n", entry.getKey(), entry.getValue()));
// Display the current cache contents for this node
System.out.println("--------------- this node");
cache.getAdvancedCache().withFlags(Flag.SKIP_REMOTE_LOOKUP)
.entrySet().forEach(entry -> System.out.printf("%s = %s\n", entry.getKey(), entry.getValue()));
Thread.currentThread().join();
}
}
My JGroups configuration file is very minimal :
<config xmlns="urn:org:jgroups"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/jgroups.xsd">
<TCP bind_port="7950" />
<TCPPING initial_hosts="192.168.42.100[7950],192.165.10.52[7950]"/>
</config>
The problem is that the cache doesn't start :
sept. 21, 2021 1:49:01 PM org.infinispan.factories.GlobalComponentRegistry preStart
INFO: ISPN000128: Infinispan version: Infinispan 'Taedonggang' 12.1.7.Final
sept. 21, 2021 1:49:01 PM org.infinispan.marshall.core.impl.DelegatingUserMarshaller start
INFO: ISPN000556: Starting user marshaller 'org.infinispan.commons.marshall.ImmutableProtoStreamMarshaller'
sept. 21, 2021 1:49:01 PM org.infinispan.remoting.transport.jgroups.JGroupsTransport start
INFO: ISPN000078: Starting JGroups channel ISPN
sept. 21, 2021 1:49:02 PM org.infinispan.remoting.transport.jgroups.JGroupsTransport startJGroupsChannelIfNeeded
INFO: ISPN000079: Channel ISPN local address is null, physical addresses are [192.168.42.100:7950]
sept. 21, 2021 1:49:02 PM org.infinispan.remoting.transport.jgroups.JGroupsTransport stop
INFO: ISPN000080: Disconnecting JGroups channel ISPN
Exception in thread "main" org.infinispan.manager.EmbeddedCacheManagerStartupException: org.infinispan.commons.CacheConfigurationException: Error starting component org.infinispan.topology.ClusterTopologyManager
at org.infinispan.manager.DefaultCacheManager.internalStart(DefaultCacheManager.java:755)
at org.infinispan.manager.DefaultCacheManager.start(DefaultCacheManager.java:718)
at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:296)
at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:219)
at TestGenerate.main(TestGenerate.java:43)
Caused by: org.infinispan.commons.CacheConfigurationException: Error starting component org.infinispan.topology.ClusterTopologyManager
at org.infinispan.factories.impl.BasicComponentRegistryImpl.startWrapper(BasicComponentRegistryImpl.java:572)
at org.infinispan.factories.impl.BasicComponentRegistryImpl.access$700(BasicComponentRegistryImpl.java:30)
at org.infinispan.factories.impl.BasicComponentRegistryImpl$ComponentWrapper.running(BasicComponentRegistryImpl.java:787)
at org.infinispan.factories.impl.BasicComponentRegistryImpl.startDependencies(BasicComponentRegistryImpl.java:622)
at org.infinispan.factories.impl.BasicComponentRegistryImpl.doStartWrapper(BasicComponentRegistryImpl.java:586)
at org.infinispan.factories.impl.BasicComponentRegistryImpl.startWrapper(BasicComponentRegistryImpl.java:564)
at org.infinispan.factories.impl.BasicComponentRegistryImpl.access$700(BasicComponentRegistryImpl.java:30)
at org.infinispan.factories.impl.BasicComponentRegistryImpl$ComponentWrapper.running(BasicComponentRegistryImpl.java:787)
at org.infinispan.factories.impl.BasicComponentRegistryImpl.startDependencies(BasicComponentRegistryImpl.java:622)
at org.infinispan.factories.impl.BasicComponentRegistryImpl.doStartWrapper(BasicComponentRegistryImpl.java:586)
at org.infinispan.factories.impl.BasicComponentRegistryImpl.startWrapper(BasicComponentRegistryImpl.java:564)
at org.infinispan.factories.impl.BasicComponentRegistryImpl.access$700(BasicComponentRegistryImpl.java:30)
at org.infinispan.factories.impl.BasicComponentRegistryImpl$ComponentWrapper.running(BasicComponentRegistryImpl.java:787)
at org.infinispan.factories.AbstractComponentRegistry.internalStart(AbstractComponentRegistry.java:354)
at org.infinispan.factories.AbstractComponentRegistry.start(AbstractComponentRegistry.java:250)
at org.infinispan.manager.DefaultCacheManager.internalStart(DefaultCacheManager.java:750)
... 4 more
Caused by: java.lang.NullPointerException: Cannot invoke "Object.equals(Object)" because the return value of "org.infinispan.remoting.transport.Transport.getAddress()" is null
at org.infinispan.topology.TopologyManagementHelper.executeOnCoordinator(TopologyManagementHelper.java:83)
at org.infinispan.topology.ClusterTopologyManagerImpl.fetchRebalancingStatusFromCoordinator(ClusterTopologyManagerImpl.java:162)
at org.infinispan.topology.ClusterTopologyManagerImpl.start(ClusterTopologyManagerImpl.java:153)
at org.infinispan.topology.CorePackageImpl$3.start(CorePackageImpl.java:74)
at org.infinispan.topology.CorePackageImpl$3.start(CorePackageImpl.java:58)
at org.infinispan.factories.impl.BasicComponentRegistryImpl.invokeStart(BasicComponentRegistryImpl.java:604)
at org.infinispan.factories.impl.BasicComponentRegistryImpl.doStartWrapper(BasicComponentRegistryImpl.java:595)
at org.infinispan.factories.impl.BasicComponentRegistryImpl.startWrapper(BasicComponentRegistryImpl.java:564)
... 19 more
If I use the demo code, the getAddress() method will indeed return something (my hostname and a number), but with the modification, the address is indeed null.
Do I have to setup manually the address ? How ?
EDIT : after some search, when I use the demo code, the receiveClusterView(View) method from JGroupsTransport class is called before the executeOnCoordinator(...) method in TopologyManagementHelper class, this set the address.
When using my xml configuration file, the receiveClusterView(view) is not called before the executeOnCoordinator() method, and as such the getAddress() fails.
Environment :
infinispan-core v12.1.7.Final
jgroups v4.2.12.Final (as dependcy from maven)
adopt-openjdk v15.0.2
macOS Big Sur
Your configuration is too minimalist :)
Infinispan requires JGroups Group Membership and Reliable Transmission to work properly.
Also, failure detection may be useful to have if you don't want to lose data on nodes crashing.
To avoid having to come up with a full valid JGroups stack, I'd use inheritance on top of one of the provided stacks
<infinispan>
<jgroups>
<!-- Creates a custom JGroups stack named "my-stack". -->
<!-- Inherits properties from the default TCP stack. -->
<stack name="my-stack" extends="tcp">
<!-- Uses TCPPING as the discovery mechanism instead of MPING -->
<TCPPING initial_hosts="192.168.42.100[7950],192.165.10.52[7950]"
stack.combine="REPLACE"
stack.position="MPING" />
</stack>
</jgroups>
<cache-container name="default" statistics="true">
<!-- Uses "my-stack" for cluster transport. -->
<transport cluster="${infinispan.cluster.name}"
stack="my-stack"
node-name="${infinispan.node.name:}"/>
</cache-container>
</infinispan>
Refer to https://infinispan.org/docs/stable/titles/embedding/embedding.html#jgroups-default_cluster-transport for more details

No instances are allowed in the image heap for a class that is initialized or reinitialized at image runtime: sun.security.provider.NativePRNG

I am getting a very strange error while I am trying to compile to native.
Here is the error:
206853 [INFO] [io.quarkus.creator.phase.nativeimage.NativeImagePhase] Running Quarkus native-image plugin on OpenJDK GraalVM CE 1.0.0-rc15
206863 [INFO] [io.quarkus.creator.phase.nativeimage.NativeImagePhase] /opt/graalvm/bin/native-image -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Drx.unsafe-disable=true -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar example-project-api-services-1.0-runner.jar -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -H:FallbackThreshold=0 -H:+PrintAnalysisCallTree -H:-AddAllCharsets -H:EnableURLProtocols=http,https --enable-all-security-services -H:-SpawnIsolates -H:+JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace
[example-project-api-services-1.0-runner:391] classlist: 12,582.29 ms
[example-project-api-services-1.0-runner:391] (cap): 1,021.83 ms
[example-project-api-services-1.0-runner:391] setup: 2,121.29 ms
13:12:55,427 INFO [org.hib.val.int.uti.Version] HV000001: Hibernate Validator 6.1.0.Alpha4
13:12:55,729 INFO [io.sma.fau.HystrixInitializer] ### Init Hystrix ###
13:12:55,731 INFO [io.sma.fau.DefaultHystrixConcurrencyStrategy] ### Privilleged Thread Factory used ###
13:12:55,731 INFO [io.sma.fau.HystrixInitializer] Hystrix concurrency strategy used: DefaultHystrixConcurrencyStrategy
13:12:55,737 WARN [com.net.con.sou.URLConfigurationSource] No URLs will be polled as dynamic configuration sources.
13:12:55,737 INFO [com.net.con.sou.URLConfigurationSource] To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
13:12:55,761 INFO [org.hib.Version] HHH000412: Hibernate Core {5.4.2.Final}
13:12:55,774 INFO [org.hib.ann.com.Version] HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
13:12:55,799 INFO [org.hib.dia.Dialect] HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL95Dialect
13:12:55,863 INFO [io.sma.ope.api.OpenApiDocument] OpenAPI document initialized: io.smallrye.openapi.api.models.OpenAPIImpl#4878969e
13:12:57,347 INFO [org.jbo.threads] JBoss Threads version 3.0.0.Alpha4
13:12:58,200 INFO [com.arj.ats.arjuna] ARJUNA012170: TransactionStatusManager started on port 38873 and host 127.0.0.1 with service com.arjuna.ats.arjuna.recovery.ActionStatusService
13:12:58,348 INFO [org.xnio] XNIO version 3.7.0.Final
13:12:58,440 INFO [org.xni.nio] XNIO NIO Implementation Version 3.7.0.Final
Warning: RecomputeFieldValue.ArrayIndexScale automatic substitution failed. The automatic substitution registration was attempted because a call to sun.misc.Unsafe.arrayIndexScale(Class) was detected in the static initializer of rx.internal.util.unsafe.ConcurrentCircularArrayQueue. Detailed failure reason(s): Could not determine the field where the value produced by the call to sun.misc.Unsafe.arrayIndexScale(Class) for the array index scale computation is stored. The call is not directly followed by a field store or by a sign extend node followed directly by a field store.
Warning: RecomputeFieldValue.ArrayBaseOffset automatic substitution failed. The automatic substitution registration was attempted because a call to sun.misc.Unsafe.arrayBaseOffset(Class) was detected in the static initializer of rx.internal.util.unsafe.ConcurrentCircularArrayQueue. Detailed failure reason(s): Could not determine the field where the value produced by the call to sun.misc.Unsafe.arrayBaseOffset(Class) for the array base offset computation is stored. The call is not directly followed by a field store or by a sign extend node followed directly by a field store.
Warning: RecomputeFieldValue.ArrayIndexScale automatic substitution failed. The automatic substitution registration was attempted because a call to sun.misc.Unsafe.arrayIndexScale(Class) was detected in the static initializer of rx.internal.util.unsafe.SpscUnboundedArrayQueue. Detailed failure reason(s): Could not determine the field where the value produced by the call to sun.misc.Unsafe.arrayIndexScale(Class) for the array index scale computation is stored. The call is not directly followed by a field store or by a sign extend node followed directly by a field store.
[example-project-api-services-1.0-runner:391] analysis: 88,298.64 ms
Printing call tree to /builds/orema/example-project/services/example-project-services/example-project-api-services/target/reports/call_tree_example-project-api-services-1.0-runner_20190517_131435.txt
Printing list of used classes to /builds/orema/example-project/services/example-project-services/example-project-api-services/target/reports/used_classes_example-project-api-services-1.0-runner_20190517_131441.txt
Printing list of used packages to /builds/orema/example-project/services/example-project-services/example-project-api-services/target/reports/used_packages_example-project-api-services-1.0-runner_20190517_131441.txt
Error: No instances are allowed in the image heap for a class that is initialized or reinitialized at image runtime: sun.security.provider.NativePRNG
Detailed message:
Trace: object java.security.SecureRandom
method net.example-project.domain.collection.control.CollectionNumber.generate()
Call path from entry point to net.example-project.domain.collection.control.CollectionNumber.generate():
at net.example-project.domain.collection.control.CollectionNumber.generate(CollectionNumber.java:24)
at net.example-project.domain.collection.control.CollectionNumber_ClientProxy.generate(Unknown Source)
at net.example-project.domain.collection.boundary.CollectionCreationContext.create(CollectionCreationContext.java:41)
at net.example-project.domain.collection.boundary.CollectionCreationContext_Subclass.create$$superaccessor27(Unknown Source)
at net.example-project.domain.collection.boundary.CollectionCreationContext_Subclass$$function$$51.apply(Unknown Source)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.stream.SortedOps$RefSortingSink$$Lambda$425/239200789.accept(Unknown Source)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at io.smallrye.restclient.async.AsyncInvocationInterceptorHandler$Decorator.lambda$decorate$0(AsyncInvocationInterceptorHandler.java:48)
at io.smallrye.restclient.async.AsyncInvocationInterceptorHandler$Decorator$$Lambda$559/661106985.run(Unknown Source)
at java.lang.Thread.run(Thread.java:748)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:473)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:193)
at com.oracle.svm.core.code.IsolateEnterStub.PosixJavaThreads_pthreadStartRoutine_e1f4a8c0039f8337338252cd8734f63a79b5e3df(generated:0)
--------------------------------------------------------------------------------------------
-- WARNING: The above stack trace is not a real stack trace, it is a theoretical call tree---
-- If an interface has multiple implementations SVM will just display one potential call ---
-- path to the interface. This is often meaningless, and what you actually need to know is---
-- the path to the constructor of the object that implements this interface. ---
-- Quarkus has attempted to generate a more meaningful call flow analysis below ---
---------------------------------------------------------------------------------------------
Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Error: Image build request failed with exit 331740
I think this logs says much about the error:
Error: No instances are allowed in the image heap for a class that is initialized or reinitialized at image runtime: sun.security.provider.NativePRNG
I found some issues # GraalVM's Github repo.
https://github.com/oracle/graal/issues/712
I think I should do something with Delay class initialization at https://quarkus.io/guides/writing-native-applications-tips
So, I wrote this piece of Java code:
#BuildStep
public RuntimeInitializedClassBuildItem secureRandom() {
return new RuntimeInitializedClassBuildItem("sun.security.provider.NativePRNG");
}
But it don't work.
So first, using #BuildStep only works during Quarkus augmentation phase: you need to be in an extension for it to work. It won't work in application code.
Second you need to delay the runtime initialization of the class holding the field so in your case, probably CollectionNumber?
So I would try to add:
<additionalBuildArgs>--delay-class-initialization-to-runtime=net.example-project.domain.collection.control.CollectionNumber</additionalBuildArgs>
to the Native image phase in your pom.xml.
You can pass additional build params for Quarkus native build by using Maven pom.xml like this (in 2021):
<profiles>
<profile>
<id>native</id>
<activation>
<property>
<name>native</name>
</property>
</activation>
<properties>
<quarkus.package.type>native</quarkus.package.type>
<quarkus.native.additional-build-args>--initialize-at-run-time=org.bouncycastle.jcajce.provider.drbg.DRBG\\,org.bouncycastle.jcajce.provider.SOMETHING_ELSE --trace-object-instantiation=sun.security.provider.NativePRNG</quarkus.native.additional-build-args>
</properties>
.....
You can try to specify the list of multiple Inner classes:
--initialize-at-run-time=org.bouncycastle.jcajce.provider.drbg.DRBG\$Default\,org.bouncycastle.jcajce.provider.drbg.DRBG\$NonceAndIV --trace-object-instantiation=sun.security.provider.NativePRNG

failing to eagerly initialize maps in hazelcast on startup

Currently I have two maps in hazelcast, and they are configured like so:
<hz:map name="some-map"
max-idle-seconds="0"
time-to-live-seconds="0">
<hz:map-store enabled="true"
initial-mode="EAGER"
write-delay-seconds="0"
class-name="SomeMapStore">
</hz:map-store>
<hz:partition-strategy>com.hazelcast.partition.strategy.DefaultPartitioningStrategy</hz:partition-strategy>
</hz:map>
I would expect the initial-mode="EAGER" from the hazelcast-beans.xml configuration to populate the hazelcast map. Instead the application process hangs for a moment, and then I see the following error:
my-service 21:14:15.247Z [hz.my-service-name.SlowOperationDetectorThread] WARN com.hazelcast.spi.impl.operationexecutor.slowoperationdetector.SlowOperationDetector - [localhost]:8085 [my-service-name-local] [3.9.4] Slow operation detected: com.hazelcast.map.impl.operation.PutTransientOperation
Has anyone run into this? I'm on hazelcast 3.9.4

java.nio.channels.UnresolvedAddressException when tranquility index data to druid

I am trying tranquility with Druid 0.11 and Kafka. When tranquility receive new data it throw the following exception:
2018-01-12 18:27:34,010 [Curator-ServiceCache-0] INFO c.m.c.s.net.finagle.DiscoResolver - Updating instances for service[firehose:druid:overlord:flow-018-0000-0000] to Set(ServiceInstance{name='firehose:druid:overlord:flow-018-0000-0000', id='ea85b248-0c53-4ec1-94a6-517525f72e31', address='druid-md-deployment-7877777bf7-tmmvh.druid-md-hs.default.svc.cluster.local', port=8100, sslPort=-1, payload=null, registrationTimeUTC=1515781653895, serviceType=DYNAMIC, uriSpec=null})
Jan 12, 2018 6:27:37 PM com.twitter.finagle.netty3.channel.ChannelStatsHandler exceptionCaught
WARNING: ChannelStatsHandler caught an exception
java.nio.channels.UnresolvedAddressException
at sun.nio.ch.Net.checkAddress(Net.java:101)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:622)
at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.connect(NioClientSocketPipelineSink.java:108)
at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.eventSunk(NioClientSocketPipelineSink.java:70)
at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendDownstream(DefaultChannelPipeline.java:779)
at org.jboss.netty.channel.SimpleChannelHandler.connectRequested(SimpleChannelHandler.java:306)
The worker was created by middle Manager:
2018-01-12T18:27:25,704 INFO [WorkerTaskMonitor] io.druid.indexing.worker.WorkerTaskMonitor - Submitting runnable for task[index_realtime_flow_2018-01-12T18:00:00.000Z_0_0]
2018-01-12T18:27:25,719 INFO [WorkerTaskMonitor] io.druid.indexing.worker.WorkerTaskMonitor - Affirmative. Running task [index_realtime_flow_2018-01-12T18:00:00.000Z_0_0]
And tranquility talk with overlord fine... I think by the following logs:
2018-01-12T18:27:25,268 INFO [qtp271944754-62] io.druid.indexing.overlord.TaskLockbox - Adding task[index_realtime_flow_2018-01-12T18:00:00.000Z_0_0] to activeTasks
2018-01-12T18:27:25,272 INFO [TaskQueue-Manager] io.druid.indexing.overlord.TaskQueue - Asking taskRunner to run: index_realtime_flow_2018-01-12T18:00:00.000Z_0_0
2018-01-12T18:27:25,272 INFO [TaskQueue-Manager] io.druid.indexing.overlord.RemoteTaskRunner - Added pending task index_realtime_flow_2018-01-12T18:00:00.000Z_0_0
2018-01-12T18:27:25,279 INFO [rtr-pending-tasks-runner-0] io.druid.indexing.overlord.RemoteTaskRunner - No worker selection strategy set. Using default of [EqualDistributionWorkerSelectStrategy]
2018-01-12T18:27:25,294 INFO [rtr-pending-tasks-runner-0] io.druid.indexing.overlord.RemoteTaskRunner - Coordinator asking Worker[druid-md-deployment-7877777bf7-tmmvh.druid-md-hs.default.svc.cluster.local:8091] to add task[index_realtime_flow_2018-01-12T18:00:00.000Z_0_0]
2018-01-12T18:27:25,334 INFO [rtr-pending-tasks-runner-0] io.druid.indexing.overlord.RemoteTaskRunner - Task index_realtime_flow_2018-01-12T18:00:00.000Z_0_0 switched from pending to running (on [druid-md-deployment-7877777bf7-tmmvh.druid-md-hs.default.svc.cluster.local:8091])
2018-01-12T18:27:25,336 INFO [rtr-pending-tasks-runner-0] io.druid.indexing.overlord.TaskRunnerUtils - Task [index_realtime_flow_2018-01-12T18:00:00.000Z_0_0] status changed to [RUNNING].
2018-01-12T18:27:25,747 INFO [Curator-PathChildrenCache-1] io.druid.indexing.overlord.RemoteTaskRunner - Worker[druid-md-deployment-7877777bf7-tmmvh.druid-md-hs.default.svc.cluster.local:8091] wrote RUNNING status for task [index_realtime_flow_2018-01-12T18:00:00.000Z_0_0] on [TaskLocation{host='null', port=-1, tlsPort=-1}]
2018-01-12T18:27:25,829 INFO [Curator-PathChildrenCache-1] io.druid.indexing.overlord.RemoteTaskRunner - Worker[druid-md-deployment-7877777bf7-tmmvh.druid-md-hs.default.svc.cluster.local:8091] wrote RUNNING status for task [index_realtime_flow_2018-01-12T18:00:00.000Z_0_0] on [TaskLocation{host='druid-md-deployment-7877777bf7-tmmvh.druid-md-hs.default.svc.cluster.local', port=8100, tlsPort=-1}]
2018-01-12T18:27:25,829 INFO [Curator-PathChildrenCache-1] io.druid.indexing.overlord.TaskRunnerUtils - Task [index_realtime_flow_2018-01-12T18:00:00.000Z_0_0] location changed to [TaskLocation{host='druid-md-deployment-7877777bf7-tmmvh.druid-md-hs.default.svc.cluster.local', port=8100, tlsPort=-1}].
What's wrong? I tried a thousand things and nothing solves it ...
Thanks a lot
UnresolvedAddressException being hit by Druid broker
You have to have all the druid cluster information set in you servers running tranquility.
It's because you only get DNS of you druid cluster from zookeeper, not the IP.
For example, on linux server, save you cluster information in /etc/hosts.

how do I turn off logging in java c3p0 connection pooling lib?

hey all, I'm just getting started with c3p0 for database connection pooling. It's attaching itself to my log4j output currently. How do I set logging off or at least to SEVERE level only for c3p0? I tried tweaking the properties file but not sure it's being picked up properly.
any ideas on how best to turn it off?
thanks
UPDATE:
this seems to work in the log4j.properties file
log4j.logger.com.mchange.v2.c3p0.impl=INFO
log4j.logger.com.mchange=INFO
For those who are NOT using a configuration file, just to add the following in the code, before loading the connection pool.
Properties p = new Properties(System.getProperties());
p.put("com.mchange.v2.log.MLog", "com.mchange.v2.log.FallbackMLog");
p.put("com.mchange.v2.log.FallbackMLog.DEFAULT_CUTOFF_LEVEL", "OFF"); // Off or any other level
System.setProperties(p);
If you use a log4j.xml file you can simple define a logger for the c3po package:
<logger name="com.mchange.v2.c3p0">
<level value="SEVERE"/>
</logger>
There are analogous methods for log4j.properties. I think it's just:
log4j.logger.com.mchange.v2.c3p0=SEVERE
I was getting messages like the following:
Tue Feb 12 13:42:01 EST 2013 INFO: Profiler Event: [FETCH] at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76) duration: 0 ms, connection-id: 67, statement-id: 23, resultset-id: 27
This made me think that C3P0 was logging these messages. Actually the message is coming from the mysql connector because I enabled profiling by using a connection string like this:
jdbc:mysql://localhost/database?profileSQL=true
Remove ?profileSQL=true to make it stop logging these messages.
I fixed problem with line of code:
com.mchange.v2.log.MLog.getLogger().setLevel(MLevel.INFO);
I am using log4j in my app.
You can set log level by adding following lines in log4j.xml
Logging at least at Error level is desired.
< category name="com.mchange" additivity="false">
< priority value="ERROR"/>
< appender-ref ref="ASYNC"/>
</ category>
If you really want to turn off c3P0 logging set property com.mchange.v2.log.FallbackMLog.DEFAULT_CUTOFF_LEVEL=OFF
in c3p0-Config.properties
or you can directly set this in code as an System property System.setProperty("com.mchange.v2.log.FallbackMLog.DEFAULT_CUTOFF_LEVEL",MLevel.OFF);
I am working on clojure, through korma and for the life of my I could not get any properties files to load (I am new to clojure so I blame myself). If you are in a similar boat, the following might help you out.
(System/setProperties
(doto (java.util.Properties. (System/getProperties))
(.put "com.mchange.v2.log.MLog" "com.mchange.v2.log.FallbackMLog")
(.put "com.mchange.v2.log.FallbackMLog.DEFAULT_CUTOFF_LEVEL" "OFF")))
The is basically a clojure port of Philippe Carriere's answer above, thank you so much!

Categories

Resources