-
Notifications
You must be signed in to change notification settings - Fork 0
User Manual
The first thing you need to do is install golang. A guide for this can be found here: Getting Started With Go
Once you complete this tutorial, you should have a workspace directory for go, pointed to by $GOPATH. This directory should contain a src/, bin/, and pkg/. If they are not there, create them. Once golang is installed and you have this directory, with $GOPATH pointing to it, and $GOBIN pointing to the /bin directory within it, you are ready for the next step.
Golang has a command-line tool 'go'. To acquire the necessary code, you're going to need to use go get which downloads and install packages and their dependencies. You'll need to run three of these:
go get github.com/garyburd/redigo/redis
go get github.com/gyuho/goraph/graph
go get github.com/Grissess/sdnd16/
Once you have done this, you should have the necessary code in your /src directory.
At this point, we need to build the code. You could build any of the test cases you wanted, but this guide will show building the client. You can do this by running
go install src/github.com/Grissess/sdnd16/client/client.go
Download, compile, and install Redis. Use redis-server to start a local instance of the redis server, and use redis-cli to talk to the redis server using the command line. To check if the redis server is working by typing redis-cli ping. It will return PONG if it is running. To save your data base use redis-cli shutdown to save the server.
To create a server to be accessed not only no your machine follow these steps. Make sure that the redis server and cli executables are in /usr/local/bin . Also create a directory to store your config files and data, /etc/redis /var/redis. Copy the init script that you'll find in the Redis distribution under the utils directory into /etc/init.d. We suggest calling it with the name of the port where you are running this instance of Redis. Make sure to modify the REDISPORT according to the port you are using. The pid file path and the configuration file name depend on the port number.
Run this command to copy a template file into /etc/redis using sudo cp redis.conf /etc/redis/6379.conf. Create a directory inside /var/redis that will work as data and working directory for your working Redis instance name it the name of your port.
Edit the configuration file, making sure to perform the following changes:
Set daemonize to yes (by default it is set to no).
Set the pidfile to /var/run/redis_6379.pid (modify the port if needed).
Change the port accordingly. In our example it is not needed as the default port is already 6379.
Set your preferred loglevel.
Set the logfile to /var/log/redis_6379.log
Set the dir to /var/redis/6379 (very important step!)
Finally add the new Redis init script to all the default runlevels using the following command:
sudo update-rc.d redis_6379 defaults
You are done! Now you can try running your instance with:
/etc/init.d/redis_6379 start
This was created by using the official redis quick start guide which can be found at this link, http://redis.io/topics/quickstart.
To use the client, you're going to need a topology file. You can write one of these very easily yourself. Simply write a text file with the following form describing each edge:src dst cost
where src is the label for the source node, dst is the label for the destination (both strings of any kind), and cost is a positive integer representing a cost, with tabs separating them all.
For example, '1 2 3' describes an edge from nodes 1 to 2 with a weight or cost of 3. 'purple red 1.5' describes an edge from nodes purple to red with a weight or cost of 1.5
Since graphs are undirected, each path should only be entered once.
To run the client, use 'go run $PATH_TO_CLIENT/client.go'
If you need any help of any kind, please email fultonms@clarkson.edu, or submit an issue on this repository.