How to connect to RedisGraph using Java JRedisGraph client - redisgraph

The JRedisGraph documentation doesn't provide example on how to connect to the instance (IP, Port).
https://github.com/RedisGraph/JRedisGraph
Please help.

Checkout the RedisGraph overloaded constructors.
public RedisGraph(String host, int port)
See: https://www.javadoc.io/doc/com.redislabs/jredisgraph/2.0.0-rc3/index.html

Related

EF Core connect from Google Cloud Run to Google Cloud SQL

I have tried these:
Data Source=/cloudsql/*****:asia-southeast2:*****;Initial Catalog=*****;Integrated Security=False;User ID=sqlserver;Password=MyPassword0!;MultipleActiveResultSets=True
that /cloudsql/*****:asia-southeast2:***** is my instance connection name described in here.
I tried public IP too like this:
Data Source=***.***.***.***;Initial Catalog=*****;Integrated Security=False;User ID=sqlserver;Password=MyPassword0!;MultipleActiveResultSets=True
with IP address my SQL instance public IP, but it is not working.
I have enabled the sql instance connection from the Cloud Run:
How can I fix the connection string using EF Core?
This is the error I got:
Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related
or instance-specific error occurred while establishing a connection to
SQL Server. The server was not found or was not accessible. Verify
that the instance name is correct and that SQL Server is configured to
allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid)
You are trying to use Cloud SQL SQL server with Cloud Run. But if you have a look to the documentation, this connexion is not supported.
In reality, the connexion is supported, but Cloud Run service open a Unix socket to connect the SQL Server instance. And there is no SQL Server client compliant with Unix Socket and therefore, you can't access it.
To solve your issue, I recommend you to use the Private IP section of this page. You can also achieve the same configuration with the public IP (don't use a serverless VPC connector and go to your Cloud SQL instance, and authorized the network 0.0.0.0/0 to access to your instance), but, because you need to open broadly the authorized network, I don't recommend you this option, for security reason.
EDIT 1
Because of my bad english, let me explain more!!
The best way is to follow the documentation page: Connect Cloud SQL private IP to your VPC, use a serverless VPC connector with Cloud Run, and in your code you can use the private IP in your connection string to access the database.
But, you can also use the public IP, that I don't recommend (see below why), at least in its first naive use. In fact, you can use the pubic IP instead of the private IP in your code. Because you use the pubic IP, you no longer need the serverless VPC connector on your Cloud Run service (you don't use the VPC but the internet to reach the internet).
However, because you use the internet and Cloud Run is a multi-customer shared service, you don't know your source IP. On Cloud SQL, you need to allow any IP (0.0.0.0/0) in the authorized network section to access to your database, which is not a very secure configuration.
Alternatively, you can create a more complex configuration on Cloud Run to use securely the Cloud SQL public IP (but it becomes really complex). let me dig into it.
I said previously that Cloud Run is a shared service, and you don't manage the source IP when you initiate outgoing call (like connection to the database). It's true, but you can control that!
Firstly, you need (again) a serverless VPC connector on your Cloud Run. And you need to set your egress to ALL (route public and private traffic to the serverless VPC connector).
Then, create a Cloud NAT in your VPC and select, at least, your serverless VPC connector subnet to be NATed when going to the internet
Reserve a public IP on your Cloud NAT configuration
Now you have a public, static IP defined on your Cloud Run service. You can only grant it on your Cloud SQL authorized Network, to improve the security and don't let anybody access to your Cloud SQL instance.

Azure - Private Link Between Virtual Networks

I have two virtual networks: public and private. On the public vnet there is an app service. On the private vnet there is an azure sql database. The azure sql database has public access blocked and is exposing a private link. The two vnets are peered. The private dns zone for the private link has both vnets linked.
When I VPN to the private vnet I can connect to the private link no problem. When I try to connect via the app service I get an error:
SqlException: Reason: An instance-specific error occurred while establishing a connection to SQL Server. Connection was denied since Deny Public Network Access is set to Yes (https://learn.microsoft.com/azure/azure-sql/database/connectivity-settings#deny-public-network-access). To connect to this server, use the Private Endpoint from inside your virtual network (https://learn.microsoft.com/azure/sql-database/sql-database-private-endpoint-overview#how-to-set-up-private-link-for-azure-sql-database).
It seems like the app service is using the public IP address (thus the error) as opposed to seeing the private IP address (via the private dns zone).
How can I set up the azure app service to connect via private link across vnets?
Update: My app service is using Docker. I ssh'ed into it and saw that the dns name was resolving to the public IP address. I temporarily added the IP to the hosts file (the private IP), but I still get the same error.
This smells more like a networking or DNS issue rather than specific to Private Link on the Azure SQL DB.
As you can SSH into your App container, can you try some network tests from there such as TRACERT to see whether it is resolving the private IP correctly and also has a suitable route in place between the virtual networks.
Haver you also checked NSGs on each virtual network to ensure that port 1433 is alloed to pass between them?
On the configuration page of your app service you need to add the following app settings:
WEBSITE_DNS_SERVER with value 168.63.129.16
WEBSITE_VNET_ROUTE_ALL with value 1

Remote connections to Infinispan server - and work with JGroups

My setup is an infinispan 8.1.2 server running on AWS using a distributed cache. For local development, I would like to be able to connect to the instance on AWS, but the server will only start using either 0.0.0.0 or the AWS private IP address. Since JGroups does not work with the 0.0.0.0 address it seems my only option would be to use the AWS private IP. But this address is not accessible remotely!
Has anyone else run infinispan server and tried to connect from a different subnet?
Not sure if this helps but anyway...
You do have a public IP address on AWS, which you can query with some HTTP command (check the docs).
Now, if you can add a NATting rule which forwards traffic between the private and public address, you could use external_addr and external_port in TCP to bind to the private address, but send traffic to the public address.
This would allow you to access a JGroups node from another subnet, or even the internet. You probably have to modify your security policy and expose the externally accessible ports. YMMV

Sending data to SSH client from server implemented in SSH Apache Mina

We are new to Apache MINA SSH server and currently working on reverse SSH
Here are the steps followed
SSHD server started on a port, server implements StreamIOHandler
Upon receiving a connection from the Device, we have IOSession, InputStream and OutputStream
Questions:
How to use this IoSession, to write the data back to the device.
Can we get ClientChannel/ClientSession associated with the IoSession. (or) these only applies, when the connection is initiated from the client to server not the otherway?
What are IOInputStream and IOOuputStream classes
It would be of great help if someone share some programs
Thanks
Vikram
It seems that you are implementing NETCONF protocol over SSH.
When the NETCONF is used over SSH, it is implemented as "netconf" channel.
So I assume you should implement an SSH subsystem in the MINA, similarly to the SftpSubsystem class, which implements Command interface
public interface Command {
void setInputStream(InputStream in);
void setOutputStream(OutputStream out);
...
}
Using setOutputStream you get an OutputStream. Whatever you write to the stream is sent to the (SSH) client.

VB.NET to connect to an Online SQL Server 2008

I can connect with VB.net to SQL Server via using connection Strings
Dim Sqlconn As New SqlConnection("Server=:serverip:;Database=:DB:; uid= :uid:; pwd=:pwd:;")
I use this to connect locally (in the office).
my question: is there a way for me to connect in an ONLINE manner? ie I will connect my application from two far locations, from the United States to the SQL Server which is in the Philippines.
I'm guessing it has something to do with the "server = ;" part of the connection string.
Any help is dearly appreciated, thank you in advance
Basically the IP could be of any location. Just replace the IP of your connection string and it will work for you. NO difference in online and offline server.
The server IP will be your Data source which is the combination of the IP and the instance name. If it is the default instance then only ip will do for you but if it is the user defined instance then you have to mention the ip\instance name too.
An online connection string is no different from a local one. Just replace the serverip part with the public facing IP address of your "online" server.
If your machine can be accessed via the internet it will have an IP address on the local network and an IP address that it uses on the Public (Internet) side.
You will need to request a static IP address from your ISP, or else this public IP address may change over time and your connection will break. There is usually a charge for this.
We ended up using a VPN Software. HAMACHI. It provided our server with a unique Public IP which I then used as input for the "Server=;" requirement of the connection string.
Might help some people who are having the same problems, but I will still welcome new answers.