How to apply Transaction timeout in Community Neo4j JAVA Bolt Driver API
I am trying to apply TransactionConfig timeout but it seems to not take effect.
session.beginTransaction(TransactionConfig.builder()
.withTimeout(Duration.ofSeconds(3))
.build())
Is there a way to automatically have threads to timeout after x seconds per query-based.
Community edition Neo4j honours configs
dbms.transaction.timeout
dbms.lock.acquisition.timeout
But is there a way to set these configs per query/transaction?
Related
The configuration that we are using.
Neo4j community server version - 3.5.51
A client Java program to insert nodes into the Neo4j database
Neo4j java driver version - 1.7.5
Jdk - 11.0.14.1
private Neo4jRepositoryManager(){
Config config = Config.builder().withConnectionTimeout(30, TimeUnit.SECONDS).withMaxConnectionPoolSize(3000).withMaxConnectionLifetime(30,TimeUnit.SECONDS).withMaxTransactionRetryTime(10,TimeUnit.SECONDS)
.build();
driver = GraphDatabase.driver( "bolt://localhost:7687", AuthTokens.basic( "****", "*****" ),config );
}
After inserting a few nodes, the neo4j server becomes extremely slow and eventually, it gets disconnected.
If we try to stop the service, it becomes unresponsive, we have manually hard kill the neo4j process and restart it to make it work again.
Any idea what we are missing here?
I'm trying to change the protocol from bolt to bolt+routing in the Kafka Neo4j Connector configuration. However I'm facing the error
"trace":"java.lang.IllegalArgumentException: Invalid address format bolt+routing\n\tat org.neo4j.driver.internal.Scheme.validateScheme(Scheme.java:46)\n\tat org.neo4j.driver.internal.SecuritySettings.createSecurityPlan(SecuritySettings.java:64)\n\tat org.neo4j.driver.GraphDatabase.driver(GraphDatabase.java:138)\n\tat streams.kafka.connect.sink.Neo4jService.<init>(Neo4jService.kt:83)\n\tat streams.kafka.connect.sink.Neo4jSinkTask.start(Neo4jSinkTask.kt:29)\n\tat org.apache.kafka.connect.runtime.WorkerSinkTask.initializeAndStart(WorkerSinkTask.java:308)\n\tat org.apache.kafka.connect.runtime.WorkerSinkTask.execute(WorkerSinkTask.java:199)\n\tat org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:185)\n\tat org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:235)\n\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n\tat java.util.concurrent.-bash-4.3$ ps aux | grep java^C hread.run(Thread.java:748)\n"}
After reviewing somethings and I get confused on Neo4j Drivers. Currently there are 2 neo4j driver: Neo4j JDBC Driver and Neo4j Java Driver. I only see Neo4j JDBC Driver supports bolt+routing, but the Neo4j Java Driver doesn't. I see Sink Connector is using Neo4j Java Driver, wondering how we can use bolt+routing in Sink Connector.
TIA
I need calculate my service uptime (e.g redis, memcached)
= success fetching metrics attempts / *total* fetching metrics attempts (every 10 sec for some period)
Can I somehow configure Telegraf to send 0/false if my input (service) is down?
Cause now if input-service is down influxdb don't receive any new metrics points from telegraf (only error logs on telegraf daemon side).
Daniel Nelson answered here https://github.com/influxdata/telegraf/issues/4563#issuecomment-413653844
that each plugin can add custom metrics to internal plugin (example: http_listener input plugin)
Current it seems we cannot run both Neo4J Server and Gremlin Server at the same time. Is there any way to have run both?
NEO4J is running and I try to start to Gremlin Server then I get the following error
java.lang.RuntimeException: GraphFactory could not instantiate this
Graph implementation [class
org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph].......................(truncated)
Gremlin Server is running and I try to start NEO4J Server then I get the following error
Caused by: org.neo4j.kernel.StoreLockException: Store and its lock
file has been locked by another process:
/home/galaxia/Documents/neo4j-gremlin/data/databases/graph.db/store_lock.
Please ensure no other process is using this database, and that the
directory is writable (required even for read-only access)
Versions
Neo4J 3.3.1
Gremlin 3.3.1
I realize it has been a while, but I finally figured this out and thought others should know. As Stephen Mallette said, you can use the Bolt implementation. To configure this for Gremlin Server, use the included gremlin-server-neo4j.yaml file and make the following change:
graphs: {
graph: conf/neo4j-bolt.properties}
Then create the neo4j-bolt.properties file with this content:
gremlin.graph=com.steelbridgelabs.oss.neo4j.structure.Neo4JGraph
#neo4j.graph.name=graph.db
neo4j.identifier=dummy
neo4j.url=bolt://localhost:7687
neo4j.username=neo4j
neo4j.password=<password>
neo4j.readonly=false
neo4j.vertexIdProvider=com.steelbridgelabs.oss.neo4j.structure.providers.Neo4JNativeElementIdProvider
neo4j.edgeIdProvider=com.steelbridgelabs.oss.neo4j.structure.providers.Neo4JNativeElementIdProvider
Remember to replace the password, and any other property with the correct values.
You cannot run them together that way (i.e. embedded mode), but it should be possible to run them together, if you either:
Configure the Neo4j graph in Gremlin Server to use HA mode as described here
Configure the Neo4j graph in Gremlin Server to use the Bolt implementation found here
Enable the Bolt protocol in the Neo4j properties file provided to Gremlin Server.
As an example of the third option, given the default Gremlin Server packaged configuration files for Neo4j, you can edit conf/neo4j-empty.properties to include:
gremlin.graph=org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph
gremlin.neo4j.directory=/tmp/neo4j
gremlin.neo4j.conf.dbms.connector.0.type=BOLT
gremlin.neo4j.conf.dbms.connector.0.enabled=true
gremlin.neo4j.conf.dbms.connector.0.address=localhost:7687
and then start Gremlin Server with bin/gremlin-server.sh conf/gremlin-server-neo4j.yaml at which point you can use standard TinkerPop drivers as well as standard Bolt connectivity against the same graph instance.
I need to secure the replication data stream between two Neo4J nodes (eg. using SSL or TLS). Both are running in embedded mode in two JBoss instances.
Is it possible and how can I do that ?
Thanks
AFAIK Neo4j replication is not encrypted by itself. The most easy way would be connecting the cluster members using a VPN (e.g. using openvpn) and configure Neo4j to use the virtual network interface provided by the VPN.
An alternative might be stunnel.
Update:
there is a nice blog post on using openvpn for encrypting Neo4j cluster replication by John Russell. Please note that this uses Neo4j <= 1.8, in Neo4j 1.9.x there is no Zookeeper any more.