Install and use the Python rq module in Ubuntu 14.04
rqYesPythonA third-party module, usingrqConvenient and quick implementationPythonTo realize the distributed architecture of multi-state computers. WhereRYesRedisMeaning,QYesQueueFirst letter,rqUseRedisAndQueueDistributedMasterAndWorker, ThroughRedisStorage task queue.
Ubuntu14.04 install rq
Assume that you have installedPythonAndpip, This article passes`pipTo installrq
$sudo pip install rq
Install
Redis
rqModule usageredisStores queue information, so that multiple machines can read the same queue at the same time, that is, multiple`workerAt the same time, this achieves our goal. InUbuntuInstallRedisIt is relatively simple. Just use the following command. In addition to the installationRedisIn addition, it will help you installredis-cli.
$sudo apt-get install redis-server
After the installation is complete, try to start it.ReidsTo check whether the installation is successful.
$ redis-server
The above command will start with the default settingsRedisService. If you see the following beautiful startup interface, the installation is successful.
However, the amount is not enough. Run the following command to see what we can see.
$ netstat -an | grep 6379
Result:
BecauseRedisThe default port is 6379. You can view the ip address of the port 6379 listener.RedisBy default127.0.0.1, You can/etc/redis/redis.conf.
RedisBound to the default configuration127.0.0.1, Comment out bind 127.0.0.1. Then restartRedis.
$ sudo /etc/init.d/redis-server restart
Execute againnetstat -an | grep 6379
As you can see,RedisYou can acceptredis cliConnected
Install
rq-dashboard
rq-dashboardIs a monitoringrqExecution statuspythonLibrary, which can display the currentQueue, EachQueueHow manyJobAnd how manyWorkerIn the working status, it also shows the failedJob. AvailablepipEasy installationDashboard.
$sudo pip install rq-dashboard
After the installation is successful, run the following command to startrq-dashboard
$rq-dashboard -u "redus://192.168.0.107:6379"
Where-uParameters are requiredRedisConnection address. The following information is displayed after the connection is started successfully.
We can see thatRq dashboardThe version information and the running address port, that is, we can access it through a browser. The default port is9181,IPThe address is startrq-dashboardMachineip, Access from a computer on the same LANhttp://192.168.0.107:9181, Where192.168.0.107Yes startrq-dashboardPCip.
Rq-dashboardIt is a useful tool for graphical monitoring.rqIs not controlledworkerBut I believe these functions will be supported soon.
rqUse
Refer to official documentation
You may also like the following article about Python:
Python: Search for files that meet the conditions in a specified directory
Python2.7.7 source code analysis
Directly run Python code without the need for the operating system
Install Python3.4 on CentOS source code
Python core programming version 2. (Wesley J. Chun). [Chinese version of hd pdf]
Python development technology details. (Zhou Wei, Zong Jie). [hd PDF scan version + book guide video + code]
Obtain Linux information using a Python script
Build a desktop algorithm transaction research environment using Python in Ubuntu
A Brief History of Python Development
Python details: click here
Python: click here