keijack / python-eureka-client

A eureka client written in python. Support registering your python component to Eureka Server, as well as calling remote services by pulling the the Eureka registry.
MIT License
184 stars 43 forks source link

how to register with hostname #36

Closed PriyatamNayak closed 3 years ago

PriyatamNayak commented 3 years ago

How to register with hostname ,instead of ip address

PriyatamNayak commented 3 years ago

@keijack Could you please advise

PriyatamNayak commented 3 years ago

anyone can help?

keijack commented 3 years ago

There is a instance_host parameter.

eureka.init(
        eureka_server=_EUREKA_URL,
        eureka_protocol="https",
        eureka_context="/eureka",
        should_discover=False,
        app_name="app",
        instance_host="app.mydomain.com",
        instance_port=9191)
PriyatamNayak commented 3 years ago

But it is binding to one instance.. Actually the app is running in 3 instances

dinuta commented 3 years ago

But it is binding to one instance.. Actually the app is running in 3 instances

:)))))

instance_host="app.mydomain.com", instance_port=9191

instance_host="app.mydomain.com", instance_port=9192

instance_host="app.mydomain.com", instance_port=9193

PriyatamNayak commented 3 years ago

How can I pass different instance ports? Can only mention the one port?

On Thu, 15 Oct 2020 at 3:27 AM, Catalin Dinuta notifications@github.com wrote:

But it is binding to one instance.. Actually the app is running in 3 instances

:)))))

instance_host="app.mydomain.com", instance_port=9191

instance_host="app.mydomain.com", instance_port=9192

instance_host="app.mydomain.com", instance_port=9193

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/keijack/python-eureka-client/issues/36#issuecomment-708612463, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJXNYTFZKUUMSVG6HDKVBXDSKX3QZANCNFSM4SMOX7IA .

--

Regards Priyatam Nayak+6584584608

keijack commented 3 years ago

According to Eureka definition, you should start 3 Eureka client for each of your instances.

PriyatamNayak commented 3 years ago

Didn’t get you.. Can you explain with sample code?

On Thu, 15 Oct 2020 at 8:40 AM, Keijack notifications@github.com wrote:

According to Eureka definition, you should start 3 Eureka client for each of your instances.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/keijack/python-eureka-client/issues/36#issuecomment-708774722, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJXNYTFRUIR4IBWGKPWKWS3SKZAITANCNFSM4SMOX7IA .

--

Regards Priyatam Nayak+6584584608

PriyatamNayak commented 3 years ago

To give info,this is pcf instances,not 3 different servers,3 containers..Code is same for all.. We can change the code for 3 different instances Have to deploy once, then we can scale the instances..hope you understand what do you mean by instances

On Thu, 15 Oct 2020 at 8:58 AM, Priyatam Nayak prisankunyk@gmail.com wrote:

Didn’t get you.. Can you explain with sample code?

On Thu, 15 Oct 2020 at 8:40 AM, Keijack notifications@github.com wrote:

According to Eureka definition, you should start 3 Eureka client for each of your instances.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/keijack/python-eureka-client/issues/36#issuecomment-708774722, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJXNYTFRUIR4IBWGKPWKWS3SKZAITANCNFSM4SMOX7IA .

--

Regards Priyatam Nayak+6584584608

--

Regards Priyatam Nayak+6584584608

keijack commented 3 years ago

Your pcf service means an application in Eureka, not instance. An instance has its own host and port, but providing the same service as other instances in the same application. You can visit your http://your_eureka_server/eureka/apps to see how "application" and "instance" means in Eureka.

PriyatamNayak commented 3 years ago

Am able to achieve it by using it in instance id.. Bcz instance I’d in pcf case is unique..

Thanks for your help

On Thu, 15 Oct 2020 at 9:44 AM, Keijack notifications@github.com wrote:

Your pcf service means an application in Eureka, not instance. An instance has its own domain and port, but providing the same service as other instances in the same application. You can visit your " http://your_eureka_server/eureka/apps" to see how "application" and "instance" means in Eureka.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/keijack/python-eureka-client/issues/36#issuecomment-708841631, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJXNYTGPPZHLUOI2FHULX5TSKZHWXANCNFSM4SMOX7IA .

--

Regards Priyatam Nayak+6584584608

keijack commented 3 years ago

If you use it in an unique way, you can set up one port in instance_port and put other ports in metadata.

keijack commented 3 years ago

I'm closing this, if you still have question, please submit a new issue.