Neutrino can run in Virtual Machine, Bare Metals or in Container. Running Neutrino in Container is the easiest method to start Neutrino since the only requirement is docker executable. Please refer to docker website for docker installation.
Running Neutrino in Docker container
- Create the slb.conf in "/etc/neutrino". Please refer to a sample slb.conf for reference
- Run Docker command "docker run -d --net=host -v /etc/neutrino:/etc/neutrino -t neutrinoslb/latest"
- Open hosts file and add canonical name(cname) entries
- 127.0.0.1 cname1.com
- 127.0.0.1 cnamewildcard.com
- Run a webserver at 9999 port and/or 9998 port. Least Connection balancer will make sure that to send the traffic only if the server is up
- Hit the URL curl cname1com:8080
- Hit the URL curl cnamewildcard.com:8080/website
Neutrino Development Environment
If are planning to develop or modify Neutrino, it is better to install the development environment. Neutrino is developed in scala. Currently, building the core requires
- JDK 1.7+
- Scala 2.11+
- SBT 0.13.7
Please follow the steps to build Neutrino
- Checkout the Git Repo GitHub
- Goto neutrino dir
- Run the command "sbt pack"
- "sbt pack" command will build Neutrino and create the jar files. You can find all the final jar files in "target/pack/lib"
- Create the slb.conf in "/etc/neutrino". Please refer to a sample slb.conf for reference
- Run "target/pack/sl-b"
- Open hosts file and add canonical name(cname) entries
- 127.0.0.1 cname1.com
- 127.0.0.1 cnamewildcard.com
- Run a webserver at 9999 port and/or 9998 port. Least Connection balancer will make sure that to send the traffic only if the server is up
- Hit the URL curl cname1com:8080
- Hit the URL curl cnamewildcard.com:8080/website
slb.conf
neutrino {
# Use this to enable/disable the direct SLB api
enable-api = true,
}
neutrino.datasource {
#Refresh time for file
refresh-period = 30s
datasource-reader = "com.ebay.neutrino.datasource.FileReader"
}
resolvers.neutrino {
listeners = [
{
# pool resolvers configured
pool-resolver = ["cname", "layerseven"],
# listening port of SLB
port = 8080,
protocol = "http"
}
]
initializers = [
"com.ebay.neutrino.metrics.MetricsLifecycle"
]
metrics = [
# Support for console logging
{ type = "console", publish-period = 1m }
]
# pools configuration
pools = [
# pool 1, lc = least connection
{ id = "cname1_id", protocol = "http", balancer = "lc", port = "8080",
# servers are the VM/Servers to which traffic will be routed
servers = [
{ id="server1", host = "localhost", port = "9999" }
{ id="server2", host = "localhost", port = "9998" }
]
# All traffic which comes with header Host=cname1.com will be routed to localhost.
# cname1.com should uniquely to idenitfy a pool
addresses = [
{ host="cname1.com" }
]
# wildcard shares the balancer and protocol with addresses
# All traffic which comes with header host=cnamewildcard.com amd path=local will be routed to localhost.
# host + path should be unique to identify the pool
wildcard = [
{host="cnamewildcard.com", path="/website" }
]
timeout= {
read-idle-timeout = 1s,
write-idle-timeout = 1s,
write-timeout = 1s,
session-timeout = 1s,
request-timeout = 1s,
connection-timeout = 1s
}
},
# pool 2
{ id = "cname2_id", protocol = "http", balancer = "round-robin", port = "8080",
servers = [
{ id="server3", host = "www.ebay1.com", port = "80" }
]
addresses = [
{host="cname2.com" }
]
wildcard = [
{host="cnamewildcard.com", path="/ebay" }
]
}
]
}