florinpatrascu / bolt_sips

Neo4j driver for Elixir
Apache License 2.0
256 stars 49 forks source link

Is routing mode enabled with neo4j+s protocol? #106

Closed Papillon6814 closed 2 years ago

Papillon6814 commented 2 years ago

Hello. I have a question. I set a url like below for connecting to a cluster database in AuraDB

config :bolt_sips, Bolt,
  url: "neo4j+s://********.*******.neo4j.io",
  basic_auth: [username: "*******", password: "*************"],
  pool_size: 10,
  ssl: true,
  max_overflow: 2,
  queue_interval: 10_000,
  queue_target: 30_000,
  prefix: :default,
  timeout: 600_000

The url starts with "neo4j+s" and not "neo4j". Then my Bolt.Sips.conn() would be:

iex(1)> Bolt.Sips.info
%{
  default: %{
    connections: %{
      direct: %{"***********************.neo4j.io:7687" => 0},
      routing_query: nil
    },
    user_options: [
      basic_auth: [
        username: "******",
        password: "******"
      ],
      socket: :ssl,
      port: 7687,
      routing_context: %{},
      schema: "neo4j+s",
      hostname: "*****************.io",
      with_etls: false,
      url: "neo4j+s://****************io",
      ssl: true,
      pool_size: 10,
      ssl: true,
      max_overflow: 5,
      queue_interval: 10000,
      queue_target: 30000,
      prefix: :default,
      timeout: 600000
    ]
  }
}

I think it is direct mode, but I think I need to connect as routing mode when I connect to a cluster. How to do it? Thank you.

florinpatrascu commented 2 years ago

Hi there. From the docs:

:url- a full url pointing to a running Neo4j server. Please remember you must specify the scheme used to connect to the server. Valid schemes: bolt,bolt+routing and neo4j - the last two being used for connecting to a Neo4j causal cluster.

neo4j will suffice. I believe their "+s" stands for secure?! But I am not familiar with that. Just make sure you enable ssl, for your connection like you did in your example.

Papillon6814 commented 2 years ago

Thank you for the prompt response! So, neo4j+s protocol cannot enable routing mode, can it?

florinpatrascu commented 2 years ago

Thank you for the prompt response!

of course, np.

So, neo4j+s protocol cannot enable routing mode, can it?

There is no mention of neo4j+s, in our docs, is it?! ;) When the user is configuring the driver with a schema we do not recognize/support, the driver defaults to :bolt - aka the :direct (non-cluster) mode. Maybe that's what you were experiencing when you mentioned the timeout story, but the info provided was insufficient to conclude the possible reason.

Papillon6814 commented 2 years ago

here is no mention of neo4j+s, in our docs, is it?! ;) When the user is configuring the driver with a schema we do not recognize/support, the driver defaults to :bolt - aka the :direct (non-cluster) mode.

I got it, thank you for the information. It really helps me!

I had thought neo4j+s protocol was famous because it is a default protocol if we create a database instance in AuraDB. (AuraDB is a partner of GCP) But is it not so famous actually?

florinpatrascu commented 2 years ago

It's simpler than you think. At the time when I implemented the support for connecting to a cluster, neo4j+s was not yet a thing :)

Papillon6814 commented 2 years ago

I got it! Okay, thank you for telling me them.