Pit Sidecar and config server Client__spring-cloud encountered in Spring-cloud

Source: Internet
Author: User

First Pit:

In the sidecar component of the Spring-cloud, Write a node.js file, when the use of Sidecar components to register JS to the Eureka, Sidecar service always prompts the Unknow status, after many lookups because the sidecar registration service to the Nodejs status as their own service status identification registered to the Eureka, and no The up is lowercase in the status:up written in Dejs, causing the problem. The up must be capitalized before it takes effect.

Attached Nodejs file as shown:

var http = require (' http ');
var url = require (' URL ');
var path = require (' path ');

Create server
var server = http.createserver (function (req, res) {
	//Get the path
	var pathname = Url.parse in the request (Req.url ). Pathname;
	Res.writehead ({' Content-type ': ' Application/json; Charset=utf-8 '});
	Access to http://localhost:8060/will return {"Index": "Welcome to the Home page"}
	if (pathname = = =) {
		res.end ({"Index": "Welcome to Homepage"});
	}
	Access to Http://localhost:8060/health will return {"status": "Up"}
	else if (pathname = = '/health.json ') {
		res.end ( Json.stringify ({"Status": "Up"});  The up must be capitalized before it can take effect
	}
	//Other case return 404
	else {
		res.end ("404");
	}
	
);

Create a listener and print the log
server.listen (8060, function () {
	console.log (' listening on localhost:8060 ');
};


Second pit: In the Test Spring-cloud config, I built two modules (server and client) in a project that inherited the same parent pom file. When I was set up in the client, the client started without loading the configuration on the server. Reason: I put the server's dependencies
Spring-cloud-config-server
Added to the parent Pom, and client dependencies are added to the Pom file in the client module, which causes the client to start without looking for the server load configuration. The server's dependencies need to be placed in the server's own pom file to avoid impacting client module dependencies.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.