Comments (16)
hi @agentzh, I have a question when recently playing ngx.socket.tcp. The problem is the host I set in /etc/hosts couldn't be used. But only native IP works. That means I have to parse /etc/hosts manually? Or if there is a module which do this job already?
from lua-resty-dns.
I'm closing this.
from lua-resty-dns.
Sure. In fact this library is bundled and enabled by default in ngx_openresty, among other things :)
from lua-resty-dns.
Great, I'm quite new to these stack can you tell me how I need to use it in ngx_openresty for my website's resources(DNS Requests)?
from lua-resty-dns.
Hello!
On Tue, Apr 2, 2013 at 11:21 AM, gauravt [email protected] wrote:
Great, I'm quite new to these stack can you tell me how I need to use it
in ngx_openresty for my website's resources(DNS Requests)?By means of the ngx_lua module:
http://wiki.nginx.org/HttpLuaModule
-agentzh
from lua-resty-dns.
Thanks π Can we also use it to speed up our website?
from lua-resty-dns.
Hello!
On Tue, Apr 2, 2013 at 11:32 AM, gauravt [email protected] wrote:
Thanks [image: π] Can we also use it to speed up our website?
It mostly depends on how you use it :)
from lua-resty-dns.
Can you give me any example to speed up a domain using lua-resty-dns?
from lua-resty-dns.
speed up a domain? you mean a dns local cache?
from lua-resty-dns.
@agentzh can add a feature to cache dns record using ngx-lua share Dict?
from lua-resty-dns.
@oikomi Just to clarify:
- nginx's own resolver already has an rbtree-based cache, so use of lua-resty-dns will not outperform the builtin resolver. The lua-resty-dns library is just much more featureful and much more flexible.
- I'm not going to add a default caching layer to lua-resty-dns because I'd like to keep this driver minimal and it is always trivial to do caching on the user side or in a higher level wrapping Lua library. Also, there are various different caching solutions out there, like
ngx.shared.DICT
andlua-resty-lrucache
.
from lua-resty-dns.
@agentzh I agree. Keep the project function minimization, Combined them.
from lua-resty-dns.
@xqpmjh Right. Neither the nginx builtin resolver nor lua-resty-dns honor the /etc/hosts file (or its equivalent on other exotic systems). For now you have to parse /etc/hosts yourself if you want to support it.
from lua-resty-dns.
@agentzh clear, thank you very much!!
from lua-resty-dns.
My problem is I need to fetch data from a website using a static ip means I have created a proxy in nginx which uses a domain+url-path but i need to use a static ip for it.
I am using Openresty with lua code in one web server and it proxy the requests to Amazon Elastic Load Balancer which doesn't provide a static ip, so is there a solution to resolve dns for elb and fetch data for the domain using returned IP.
from lua-resty-dns.
@gauravt You're recommended to ask such general questions on the openresty-en mailing list where you're more likely to get answers: https://groups.google.com/group/openresty-en Thank you for your collaborations!
Regarding your question, you can use the nginx's own dynamic resolver to do the magic for you. For example,
location / {
resolver 8.8.8.8; # here we use Google's open DNS server just as an example
set $backend "my-aws-load-balancer-dns-name";
proxy_pass http://$backend;
}
Use of nginx variables in proxy_pass
will make nginx resolve the DNS name nonblockingly on the fly and cache the resolved IP addresses automatically according to the TTL setting in the DNS records.
from lua-resty-dns.
Related Issues (20)
- /etc/hosts support? HOT 3
- Getting "failed to set peer name: resource temporarily unavailable" when using the module
- How does the module process for cache? HOT 2
- add "nameservers" to docs HOT 1
- the TCP client does not do any retries ('retrans' option) HOT 3
- dead resolver raises exception HOT 2
- how does the r:query parameter option:qtype? HOT 4
- is it possible to cache the answers for 15 secs? HOT 2
- Test case failing on rhel 7.6 ppc64le platform HOT 1
- how to return ipv4 address only.... HOT 6
- domain name resolution on pure ipv6 kubernetes HOT 1
- εε解ζζ₯ι code=3
- How to get the fixed TTL?
- wire format HOT 5
- Return domain name by ip address HOT 1
- Error doing NS query
- tcp_sock is closed after tcp_query
- Use EDNS
- Does it support access via proxyοΌ
- DNS ERROR HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lua-resty-dns.