> Hi there, > > I have two uwsgi servers (let me call them master and slave) that need > to sync some in-memory data via cache2. I wrote such config on the > master whose ip is 10.1.1.11: > > [uwsgi] > vaccum = true > workers = 4 > cpu-affinity = 1 > master = true > need-app = true > manage-script-name = true > enable-threads = true > socket = /tmp/uwsgi0.sock > socket = /tmp/uwsgi1.sock > socket = /tmp/uwsgi2.sock > socket = /tmp/uwsgi3.sock > map-socket = 0:1 > map-socket = 1:2 > map-socket = 2:3 > map-socket = 3:4 > mount = /test=/home/lliu/test/test-wsgi.py > daemonize = /var/log/test/running.log > max-requests = 1024 > listen = 1024 > cache2 = > name=test-conf-cache,items=8192,blocksize=2048,store=/shared_disk/test_cache2.dump,nodes=10.1.1.12:7171,udp=10.1.1.11:7171 > > on the slave server whose ip is 10.1.1.12: > [uwsgi] > vaccum = true > workers = 4 > cpu-affinity = 1 > master = true > need-app = true > manage-script-name = true > enable-threads = true > socket = /tmp/uwsgi0.sock > socket = /tmp/uwsgi1.sock > socket = /tmp/uwsgi2.sock > socket = /tmp/uwsgi3.sock > map-socket = 0:1 > map-socket = 1:2 > map-socket = 2:3 > map-socket = 3:4 > mount = /test=/home/lliu/test/test-wsgi.py > daemonize = /var/log/test/running.log > max-requests = 1024 > listen = 1024 > cache2 = > name=test-conf-cache,items=8192,blocksize=2048,store=/shared_disk/test_cache2.dump > > The dump file test_cache2.dump is stored on an NFS partition mounted > at /shared_disk accessible to both of the master and slave. However, > after I start up the two uwsgi services, the change of cache2 (e.g. > add a new item via cache_set api) on the master can not be propagated > to the slave. I actually tried other cache2 settings, like: > > cache2 = > name=test-conf-cache,items=8192,blocksize=2048,store=/shared_disk/test_cache2.dump,nodes=10.1.1.12:7171,udp=10.1.1.11:7171 > cache2 = > name=test-conf-cache,items=8192,blocksize=2048,store=/shared_disk/test_cache2.dump,nodes=127.0.0.1:7172,udp=127.0.0.1:7171 > cache2 = > name=test-conf-cache,items=8192,blocksize=2048,sync=10.1.1.11,nodes=127.0.0.1:7172,udp=127.0.0.1:7171 >
Both server must bind to an address reachable by the other one. A minimal example: (slave udp on port 3030) uwsgi -M --cache2 name=foo,items=100,udp=127.0.0.1:3030 -s :3032 (master udp on port 1717, push to port 1717) uwsgi -M --cache2 name=foo,items=100,udp=127.0.0.1:1717,nodes=127.0.0.1:3030 -s :3031 --load-file-in-cache /etc/services once master is started (after the slave) the /etc/services object will be available on both Updates are not realtime as data are transferred asynchronously via udp. It depends on your use-case, if you want perfectly consistent caches this is not the right approach -- Roberto De Ioris http://unbit.it _______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
