How to get Ribbon to use IPs instead of hostnames - spring-cloud-netflix

I've created a Zuul server using the '#EnableZuulProxy' annotation. So I'm using Spring Cloud.
I can see it getting its info from Eureka and it is using Ribbon to executed requests. So far so good.
But it is using the hostnames from the Eureka data instead of the IP addresses. That is a problem for me since not all my hosts have their name in DNS.
I tried using 'ribbon.useIPAddrForServer=true' but I do not see a change in behavior.
I'm using 1.0.3.RELEASE at the moment.
Any thoughts on what I can do to resolve this?
Thanks.
Henry

Turns out I had to use 'ribbon.UseIPAddrForServer=true'. Notice the capital 'U'.

Related

Azure fails when try to create a MySQL database

When I try to create a MySQL database on Microsoft Azure using pure REST request (PUT) to:
https://management.azure.com/subscriptions/<subscriptionid>/resourceGroups
/resource-<id>/providers/successbricks.cleardb/databases/<my-database>?
api-version=2014-04-01
I am getting this error:
HTTP STATUS CODE 400 Bad Request
Error message: 'Legal terms have not been accepted for this item on
this subscription. To accept legal terms, please go to the Azure
portal (http://go.microsoft.com/fwlink/?LinkId=534873) and configure
programmatic deployment for the Marketplace item or create it there
for the first time'
So I went to Microsoft Azure Portal, and I accepted the legal terms. I tried again, same error. I searched in almost the entire Azure Portal for some configuration about this and I found nothing.
Someone have the same problem?
Thanks.
you should not only accept the terms but follow the procedure of making the programmatic access possible. It should be on the license page.
Programmatic deployment only can be found in Virtual Machines MySQL, not in Data Storage MySQL Database. Try REST request after you enabled programmatic Deployment.
In addition, I successfully created a MySQL database using REST API without reproducing your question, but note that the request body need to be sent as well when using PUT request.
OK guys, found the solution. I don't know why, but if we change the JSON attribute { "plan.name": "Pay-As-You-Go" } to { "plan.name": "Free" } the database is created successfully.
I opened a support ticket to know which are the MySQL available plans. I will update the answer as soon as possible.

Can I use "new ServerSocket(0)" with openshift

I have developed an application that allows multiple players to play together on line at various games such shifumi, poker, chess and so on. It works very well on my localhost. I would like to publish it. So I decided to use openshift to do this.
But there is a problem.
It seems it come from this statement : new ServerSocket(0). I do this inside the doPost method of an HttpServlet.
Could you tell me I don't have the permission to do this (new ServerSocket(0)) inside an openshift server?
I think you have a couple of issues going on here.
The first is that when you call new ServerSocket(0), it is going to try to find a socket that it can bind to, probably on either 0.0.0.0 (all ip addresses/interfaces) or 127.0.0.1, neither of which is allowed on OpenShift.
According to the documentation (located here: http://download.java.net/jdk7/archive/b123/docs/api/java/net/ServerSocket.html) you can use one of the overloaded methods to provide an ip address to bind to, which should be your OPENSHIFT__IP (where could be jbosseap, jbossas, wildfly, jbossews, etc).
ServerSocket(int port, int backlog, InetAddress bindAddr)
Your second issue is a bit more complicated, basically what ports you can bind to. OpenShift allows user code to bind to ports 15000-20000, depending on what ports are not being used by other applications or services. However, none of those ports are open to the public internet, they are all internal ports for internal communications, so if you are trying to let a client connect to them, it won't work. The only ports that are publicly available are 80/443/8000/8443, and your application must bind to port 8080 on your OPENSHIFT__IP to be able to be reached using your app-domain.rhcloud.com public url. You can check out this article to read more about how all of the binding and routing works: https://developers.openshift.com/en/managing-port-binding-routing.html
Hopefully that answers the question about why that piece of code is not working.

APPFabric client communication error?

I have configured 2 AppFabric instances and try to connect from a test client to the cache.
At first, I had trouble establishing the cache using the DataCacheFactory, but after opening the 22233-22235 ports in the firewall I have managed to get the cache using the DataCacheFactory.
As soon as I try to use the cache for a very small object (using a simple get), I get the following with a null InnerException:
ErrorCode:SubStatus:The connection was terminated, possibly due to server or network problems or serialized Object size is greater than MaxBufferSize on server. Result of the request is unknown.
I don't believe it's the MaxBufferSize issue (I also modified the transportProperties in the config just to make sure), but on the other hand - I'm able to get the cache, which I believe should indicate that the client can communicate with the server. So what is it? -How can I get more details on this issue?
Thanks in advance,
Nir.
Got this to work!
All I needed to do was just to add the host names, as appear in ClusterConfig file to the hosts file of the client, and that's it!
Hope that helps anyone,
Nir.

Does a certificate have to be valid to mail using CDOSYS and SMTPS?

Due to a limitation on our SMTP provder's side, we're having to use System.Web.Mail (deprecated), which is a wrapper around CDOSSYS.
Because we'd like to avoid having to change multiple configurations if we switch providers at a later date, we set up an internal alias for our providers FQDN.
So, mailrelay.ourdomain.com -> mailrelay.provider.com.
When I try to connect to either our alias or the provider's IP, a COM error bubbles up: "The transport failed to connect to the server." If I connect to the provider's true FQDN, everything works as expected.
I've looked in Wireshark, and I can see the certificate being requested, but not much happens after that.
I'm wondering if anyone knows if CDOSSYS checks to make sure the requested host name matches the FQDN on the certificate and fails if it doesn't match.
I've tried searching for an answer to this question, but I can't seem to find it.
I can't find a definitive answer, but from what I can tell, yes, CDOSYS does require a certification to match an SMTP server's FQDN when using SSL.

Starting multiple HTTP listeners on IIS using C#.NET 2.0

I have two windows services running on the same machine. Both the services uses
private HttpListener listener;
I specify the baseURL as "http://IPAddress:8080/" & "http://IPAddress:8081/" respectively for each of the services. Then I do the needful and call
listener.Start();
The first service starts successfully at 8080 port. But when I now start the 2nd service,
I get HTTPListenerException "The process cannot access the file because it is being used by another process" for listener object.
Could anybody please tell me:
1) If it is possible to start two HTTP listeners on the same IIS at two different ports.
2) If yes, how can we achecive this?
3) Is there any other way of doing this?
For your information:
I am using C#.NET 2.0 and IIS 6.0 server.
Thanks & Regards,
Hari
Doesn't HttpListener work independently from IIS? Can you stop the IIS service and see what happens?
Or maybe port 8081 is used by another program or process. I suggest to try to set the port to another number. You could open a command line and execute the "netstat" command to see if the port is used before starting your services.
(source: googlepages.com)
The HTTPListener is indeed not a part of the IIS. It's just C# code.
did you do it like this?
String[] prefixes = { "http://localhost:8280/", "http://localhost:8281/"};
HttpListener listener = new HttpListener();
listener.Prefixes.Add("http://localhost:8280/");
listener.Start();
1) If it is possible to start two HTTP listeners on the same IIS at two different ports.
Yes, it is. But listeners on the IIS is not made through code, it's through the IIS administration tool, so that's probably not what you're trying to do. IIS is separate from the c# code you're attempting.
2) If yes, how can we achecive this?
Try some other port numbers (like 58080 and 58081) and try replacing "IPAddress" with "localhost". Most likely your port number is used by some other web server
3) Is there any other way of doing this?
If you're trying to serve web pages, you probably wan't to make a web application instead of making your own HTTP server
If you're doing something custom, you might want to take a look at WCF (Windows Communication Foundation), as it's the new framework for web, sockets, web services etc. and it's what MS will be using going forward
It's usually a good idea to take a quick look at this page when using port numbers...just to make sure a temp number you're trying to use isn't in use already.