titangremlinrexstertinkerpop3gremlin-server

Titan Gremlin Server is giving Error "not a WebSocket handshake request: missing upgrade"


I downloaded Titan Version 1.0 on EC2 server from url

Titan 1.0.0 with Hadoop 1 – recommended

Then I unzip and ran the titan server with following command :

bin/titan.sh start

Forking Cassandra...
Running `nodetool statusthrift`... OK (returned exit status 0 and printed string "running").
Forking Elasticsearch...
Connecting to Elasticsearch (127.0.0.1:9300).... OK (connected to 127.0.0.1:9300).
Forking Gremlin-Server...
Connecting to Gremlin-Server (127.0.0.1:8182).... OK (connected to 127.0.0.1:8182).
Run gremlin.sh to connect.

Then I tried from HTTP Request in Titan 1.0 Version (in titan 0.4 version Rexster is working properly) But I'm getting following Error

not a WebSocket handshake request: missing upgradeTitan 1.0 HTTP Request Error


Solution

  • Using the default setup, you cannot connect to Titan v1.0.0 via an HTTP connection. More precisely, you cannot connect to Gremlin Server via HTTP.

    When using Titan, you're also using Gremlin Server from the Apache TinkerPop framework. Gremlin Server accepts WebSocket connections (default) and forwards queries to Titan server.

    For Titan v1.0.0, which ships with TinkerPop v3.0.1 (therefore Gremlin server v3.0.1), you need to manually configure the HttpChannelizer in the conf/gremlin-server/gremlin-server.yaml file:

      channelizer: org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer
    

    See also: TinkerPop v3.0.1 documentation: Connecting via REST.

    This replaces the default WebSocketChannelizer and allows you to send queries to Gremlin Server via HTTP. When you run ./bin/titan.sh start, you're actually starting Gremlin Server along with all the Titan related stuff (Titan instance, Cassandra and Elasticsearch in the default setup).

    If you must use a browser and still wish to use a WebSocket connection, you can use https://github.com/jbmusso/gremlin-javascript which is a JavaScript (Node.js/Browser) client for Gremlin Server. It supports WebSocket connections in the browser. You do not have to edit anything in the gremlin-server.yaml file when using this setup.