How to load balance several phoenix query servers behind Knox gateway? - apache-zookeeper

I have 3 phoenix query servers running behind a knox gateway (hiding kerberos auth complexity), accessed through Simba's odbc driver. I manage to reach one phoenix query server and launch queries through knox, by directly mapping, in topology file, avatica service to the internal ip address and port of one phoenix query server in my internal network.
I would like to have knox randomly access either of my 3 phoenix query servers, not just one. Do you know if i can achieve this with zookeeper and how i can configure it to do this ?
I've already tried to make some loadbalancing bu making knox topology pointing on an nginx reverse proxy, setting as upstream my 3 PQS but i'm having a 401 error, likewise my credentials were transmitted trough the proxy
my odbc.ini file :
[phoenixovh]
Driver=/opt/hortonworks/phoenixodbc/lib/64/libphoenixodbc_sb64.so
Host=knox.<clusterid>.datalake.ovh
Port=443
AuthMech=2
UID=<user>
PWD=<password>
LogLevel=0
ConnectionSyncInterval=120
SSL=1
HttpPath=gateway/default/avatica
TransportMode=http
part of my knox topology file (working for 1 PQS) (default.xml)
<service>
<role>AVATICA</role>
<url> internal_address__and_port_of_url_of_one_pqs</url>
</service>

I finally managed to have my 3 PQS reached by following know ha guide (https://cwiki.apache.org/confluence/display/KNOX/Dynamic+HA+Provider+Configuration), adding in my topology file an ha provider section and providing 3 urls in the service configuration instead of one:
<provider>
<role>ha</role>
<name>HaProvider</name>
<enabled>true</enabled>
<param>
<name>AVATICA</name>
<value>maxFailoverAttempts=3;failoverSleep=1000;maxRetryAttempts=300;retrySleep=1000;enabled=true</value>
</param>
</provider>
</gateway>
...
<service>
<role>AVATICA</role>
<url>internal url of PQS1</url>
<url>internal url of PQS2</url>
<url>internal url of PQS3</url>
</service>
Knox guide mentions this way and also the zookeeper's connection string but does not provide any insights on which solution is better.

Related

Quarkus - connect to muli hosts with reactive driver

I need to connect to multiple postgres hosts with hibernate-reactive
As an example, with the classic jdbc driver, we can define this property to connect to our HA postgres instance:
quarkus.datasource.jdbc.url=jdbc:postgresql://my.host-1.com,my.host-2.com,my.host-3.com:5432/myDB?targetServerType=master&ssl=true&sslmode=verify-ca&sslcert=my-cert&sslkey=my-key&sslpassword=&sslrootcert=my-cert.crt
But here I saw that the vert.x PgClient does not support multi host connections directly in connection URI
I created an issue in vertx-sql-client here and a developer said me that it would be already possible by using the PgConnectOptions and a PgPool.
I did not see anything related in quarkus hibernate-reactive documentation.
Can anyone help me on this ? It seems we have to manage connections by URI.

How to Read message from Jboss JMS Queue using IIB ESB Toolkit

I am working on a small project in which I want to consume the messages from the Jboss JMS Queue using IIB Tool kit. Apologize me that I am a learner in IIB.
The scenario is as below.
The Linux server is where the JBOSS is running and the messages are available in a particular JMS queue. I got IBM Toolkit installed on my laptop/machine and created an application and a flow. I placed the JMSInput from the pallet and got confused on where to configure the connection properties like IP Address, port number, Jboss user, password etc...
The idea is to consume the messages that are available in Linux server using IIB. Request some expert help on how to configure and achieve this requirement.
The jnp based Initial Context Factory seems like not supported in JBOSS 7 anymore. I would use the one described in Remote JNDI Lookup.
I never did an IIB integration with a JMS provider in JBoss, but I did it with a standalone ActiveMQ. There I created a JMSProviders configurable service, where I could configure IP address and port in the jndiBindingsLocation property like this:
mqsicreateconfigurableservice <BROKER> -c JMSProviders -o ActiveMQ \
-n initialContextFactory,jarsURL,jndiBindingsLocation,connectionFactoryName \
-v org.apache.activemq.jndi.ActiveMQInitialContextFactory,c:\Users\daniel\apache-activemq-5.11.1\lib,tcp://localhost:61616,ConnectionFactory
See Securing JMS connections and JNDI lookups how to enter user id and password.

Trying to use AWS EC2 node.js app to talk to AWS Mongo Linux instance via AWS ELB

I have 2 x AWS EC2 instances with a node.js app. Out of the box, they come with a local mongod instance that works fine. Given the criticality of the app, I decided to spin up 2 x EC2 front ends (node js) to talk to a mongo db in another availability zone using the AWS ELB.
Full IP communication/27017 connectivity exists between all 3 nodes.
When using only 1 server to the mongo server, it works just fine. When adding both front end servers into the ELB target group, I get random 504 gateway errors.
Removing a server from the group fixes the issue.
Any suggestions on what I should look for?
In terms of how the node.js server connects to mongo, there is a config.json file that simply points out the IP and DB name required.
Thanks!
AWS Load Balancer use "round robin" mechanism to route user's requests. Does your application have way to control user sessions? If not then your first request come to server 1, then second request to server 2 which doesn't have any information to the first request may result in error. That explain why it works fine when you have 1 server only
the server uses redis (the app server) and the following components:
Node.js - Server-side Javascript-framework
Express.js - Web application framework for Node.js
Nginx - Web server & reverse proxy
MongoDB - NoSQL database
redis - Session Manager & data structure server
Socket.IO - Bi-directional communication between web clients and servers

Service Fabric 0x80004005 Access denied Open up port for HttpListener

I am facing the following error message in my local (development) service fabric instance:
2016-09-20 12:56:16.5008 WARN 7 Metrics.Visualization.MetricsHttpListener Unable to start HTTP Listener. Sleeping for 1 sec and retrying 2 more times System.Net.HttpListenerException (0x80004005): Access is denied
at System.Net.HttpListener.AddAllPrefixes()
at System.Net.HttpListener.Start()
at Metrics.Visualization.MetricsHttpListener.Start() in C:\Work\Metrics.NET\Src\Metrics\Visualization\MetricsHttpListener.cs:line 97
at Metrics.Visualization.MetricsHttpListener.<>c__DisplayClass15_0.<<StartHttpListenerAsync>b__0>d.MoveNext() in C:\Work\Metrics.NET\Src\Metrics\Visualization\MetricsHttpListener.cs:line 62
Metrics.Net is trying to open a port. Obviously that fails. I wonder how I can fix this issue.
To my ServiceManifest.xml I added the following line:
<Resources>
<Endpoints>
<!-- This endpoint is used by the communication listener to obtain the port on which to
listen. Please note that if your service is partitioned, this port is shared with
replicas of different partitions that are placed in your code. -->
<Endpoint Name="MyApplicationTypeEndpoint" Protocol="http" Port="20002" />
</Endpoints>
</Resources>
Port is correct.
Is there anything else I should take care of?
(Also on a side note - how can I open up port ranges instead of single ports?)
Are you sure the URL you're adding to the HttpListener Url Prefix is using the port defined in ServiceManifest.xml?
"Access denied" either means:
Someone else is already using that port
You are not using the port that you set up in ServiceManifest.xml
You can already use any port from the application port range. That range is a set of ports in the high-port-number range that Service Fabric opens through the OS firewall. Those ports come from the same pool of application ports that the TCP/IP stack gives you when you open a socket on port 0. Or, if you set up an Endpoint config in ServiceManifest.xml and don't specify a port number there, you'll get a random port from this range.
The ports you defined in ServiceManifest.xml are mainly for http.sys URL ACLing. It will also open a port through the OS firewall if it is a port outside of the application port range.
"Opening" the ports to the Internet through a load balancer is a different story and isn't really related to Service Fabric. That's more of a hardware/topology configuration (Service Fabric is all software). In Azure you can configure that through your cluster's Resource Manager JSON, or even through the Azure portal when you're creating a cluster.
The application port range is defined per node in your cluster (or per VMSS in Azure).

Swing Client - EJB2 lookup over HTTP in JBoss 5.1

I have a swing client which connects to my ejb2 application deployed in JBoss 5.1. There is a particular requirement from Customer to make it available on internet.
The deployment architecture is as follows,
swing_client --> extranet_ip |firewall | --> iis7_machine --> jboss5.1_machine.
jndi properties in client is as follows
Context.PROVIDER_URL=http://extranet_ip:9180/invoker/JNDIFactory
Context.INITIAL_CONTEXT_FACTORY=org.jboss.naming.HttpNamingContextFactory
This configuration works fine when the client is inside intranet. But it does not work in internet (extranet).
When I tried initially I got the error 'Connection refused'
After seeing some posts in various forums, I changed the file server\deploy\http-invoker.sar\META-INF\jboss-service.xml, to reflect the extranet_ip in invokerURL.
Aftet this I am getting the following error.
org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection for InvokerLocator [socket://10.200.1.193:4546/?dataType=invocation&enableTcpNoDelay=true&marshaller=org.jboss.invocation.unified.marshall.InvocationMarshaller&unmarshaller=org.jboss.invocation.unified.marshall.InvocationUnMarshaller]
Where 10.200.1.193 is the intranet IP address of JBoss Server machine.
I tried changing the trasport parameter in remoting-jboss-beans.xml to http, but at that time client is not working in both intranet and extranet.
Please anybody suggest a way forward for this issue. Or is there any other way to implement RMI over Http in JBoss?
Update: As a solution, I had to change my deployment architecture as follows.
swing_client --> extranet_ip |firewall | --> jboss5.1_machine
where the JBoss Application Server will be directly exposed through firewall. Then update clientConnectAddress in the remoting-jboss-beans.xml to the extranet IP. Also open the ports 8080 & 4446 in the firewall for this address.
This way the swing client is working if I use the jnid properties as follows.
Context.PROVIDER_URL : http://extranet_ip:8080/invoker/JNDIFactory
Context.INITIAL_CONTEXT_FACTORY : org.jboss.naming.HttpNamingContextFactory
But still looking for a solution where there is no need to open any non-standard ports and no need to expose the Application Server directly.
After a long struggle I found a solution for my issue. The solution was to change EJB container's invoker type to http in standardjboss.xml. When the invoker is http, it will use the settings in http-invoker.sar for remote binding.