Install and use the Python rq module in Ubuntu 14.04
rq
YesPython
A third-party module, usingrq
Convenient and quick implementationPython
To realize the distributed architecture of multi-state computers. WhereRYesRedis
Meaning,QYesQueue
First letter,rq
UseRedis
AndQueue
DistributedMaster
AndWorker
, ThroughRedis
Storage task queue.
Ubuntu14.04 install rq
Assume that you have installedPython
Andpip
, This article passes`pip
To installrq
$sudo pip install rq
Install
Redis
rq
Module usageredis
Stores queue information, so that multiple machines can read the same queue at the same time, that is, multiple`worker
At the same time, this achieves our goal. InUbuntu
InstallRedis
It is relatively simple. Just use the following command. In addition to the installationRedis
In addition, it will help you installredis-cli
.
$sudo apt-get install redis-server
After the installation is complete, try to start it.Reids
To check whether the installation is successful.
$ redis-server
The above command will start with the default settingsRedis
Service. 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:
BecauseRedis
The default port is 6379. You can view the ip address of the port 6379 listener.Redis
By default127.0.0.1
, You can/etc/redis/redis.conf
.
Redis
Bound 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,Redis
You can acceptredis cli
Connected
Install
rq-dashboard
rq-dashboard
Is a monitoringrq
Execution statuspython
Library, which can display the currentQueue
, EachQueue
How manyJob
And how manyWorker
In the working status, it also shows the failedJob
. Availablepip
Easy 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-u
Parameters are requiredRedis
Connection address. The following information is displayed after the connection is started successfully.
We can see thatRq dashboard
The version information and the running address port, that is, we can access it through a browser. The default port is9181,IP
The address is startrq-dashboard
Machineip
, Access from a computer on the same LANhttp://192.168.0.107:9181
, Where192.168.0.107
Yes startrq-dashboard
PCip
.
Rq-dashboard
It is a useful tool for graphical monitoring.rq
Is not controlledworker
But I believe these functions will be supported soon.
rq
Use
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