How to connect rethinkdb in Openshift using rethinkdbdash

104 views Asked by At

Could someone help to connect to rethinkdb in openshift using rethinkdbdash

I have deployed rethinkdb in openshift & create 3 clusterIP services
1.8080 - admin
2.29015 - intracluster communicated
3.28015 - client connection

I have created a route which targets client connection clusterIP service(port 28015)
I tried to use that from client side as below

 const r = require('rethinkdbdash')({  
  cursor: true,  
  silent: true,  
  host: rethink-client.test.exchange.com,    
  port: 80  
 )}

I am getting below error

     data: Timeout during operation
(node:5739) UnhandledPromiseRejectionWarning: Error: Cannot wrap non-Error object

client Route

1

There are 1 answers

2
Daein Park On

You should use NodePort or LoadBalancer type Services to expose your DB connection to external instead of Route. Because Route does not support TCP protocol. Refer here for supported protocols. For instance of mysql db, further details are provided in Using a NodePort to Get Traffic into the Cluster.

apiVersion: v1
kind: Service
metadata:
  name: mysql
  labels:
    name: mysql
spec:
  type: NodePort
  ports:
    - port: 3306
      nodePort: 30036
      name: http
  selector:
    name: mysql