jiangwenyuan / nuster

A high performance HTTP proxy cache server and RESTful NoSQL cache server based on HAProxy
Other
1.91k stars 157 forks source link

detailed setup guide for noobs #95

Closed Hellerprime closed 4 years ago

Hellerprime commented 4 years ago

Dears can anyone help with setting up nuster as cache server i am not a pro at all Best Regards

jiangwenyuan commented 4 years ago

@Hellerprime

Since I have no idea of your environment, so I will show you how to setup as a simple cache server and you can start from there.

Assume you have a backend http server at 10.10.10.10:8080, and you want to cache all requests for 1 minute.

First you need to install it

wget https://github.com/jiangwenyuan/nuster/releases/download/v5.2.2.22/nuster-5.2.2.22.tar.gz
tar xf nuster-5.2.2.22.tar.gz && cd nuster-5.2.2.22
make TARGET=linux-glibc

Then you need create a config file:

global
    nuster cache on data-size 200m
    master-worker
    debug
frontend fe
    bind *:8080
    mode http
    default_backend be
backend be
    mode http
    nuster cache on
    nuster rule all memory on
    server s1 10.10.10.10:8080

save it to nuster.cfg and start with ./haproxy -f nuster.cfg

Now you have the nuster cache server in front of your http server, and you make requests to nuster.

curl http://127.0.0.1:8080/

The request will go to nuster and since there's no cache yet, nuster will forward it to backend server at 10.10.10.10:8080, and cache the response. Next time if you do the request again, nuster will serve the request directly.

Next, I'd suggest you read online haproxy doc and https://github.com/jiangwenyuan/nuster#directives

Hellerprime commented 4 years ago

Dear im trying to install and the following error when using make tried centos , ubuntu make TARGET=linux-glibc /bin/sh: 1: gcc: not found CC src/ev_poll.o /bin/sh: 1: gcc: not found Makefile:887: recipe for target 'src/ev_poll.o' failed make: *** [src/ev_poll.o] Error 127

jiangwenyuan commented 4 years ago

https://github.com/jiangwenyuan/nuster/blob/master/INSTALL#L83