个人项目ops
一。 常规步骤启动
1. 启动env环境

env环境使用python2.7.9 + django 1.8.3

wfq@ubuntu:~$ source env27/bin/activate
(env27)wfq@ubuntu:~$ python
Python 2.7.9 (default, Apr 13 2018, 19:19:14) 
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.VERSION
(1, 8, 3, 'final', 0)
>>> exit()
(env27)wfq@ubuntu:~$ 
2. 启动redis
(env27)wfq@ubuntu:~$ redis-server &
(env27)wfq@ubuntu:~$ redis-server &
[1] 28173
(env27)wfq@ubuntu:~$ [28173] 05 May 15:41:31.805 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
[28173] 05 May 15:41:31.806 # Unable to set the max number of files limit to 10032 (Operation not permitted), setting the max clients configuration to 3984.
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 2.8.4 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in stand alone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 28173
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

[28173] 05 May 15:41:31.809 # Server started, Redis version 2.8.4
[28173] 05 May 15:41:31.810 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
[28173] 05 May 15:41:31.810 * DB loaded from disk: 0.000 seconds
[28173] 05 May 15:41:31.810 * The server is now ready to accept connections on port 6379
(env27)wfq@ubuntu:~$ ps -ef | grep redis
wfq       28173  27634  0 15:41 pts/4    00:00:00 redis-server *:6379
wfq       28187  27634  0 15:41 pts/4    00:00:00 grep --color=auto redis
(env27)wfq@ubuntu:~$ 
3. 启动celery
(env27)wfq@ubuntu:~/ops$ python manage.py celery worker -c 2 --loglevel=info &
(env27)wfq@ubuntu:~/ops$ python manage.py celery worker -c 2 --loglevel=info &
[2] 28208
(env27)wfq@ubuntu:~/ops$ /home/wfq/python27/lib/python2.7/site-packages/celery-3.1.25-py2.7.egg/celery/apps/worker.py:161: CDeprecationWarning: 
Starting from version 3.2 Celery will refuse to accept pickle by default.

The pickle serializer is a security concern as it may give attackers
the ability to execute any command.  It's important to secure
your broker from unauthorized access when using pickle, so we think
that enabling pickle should require a deliberate action and not be
the default choice.

If you depend on pickle then you should set a setting to disable this
warning and to be sure that everything will continue working
when you upgrade to Celery 3.2::

    CELERY_ACCEPT_CONTENT = ['pickle', 'json', 'msgpack', 'yaml']

You must only enable the serializers that you will actually use.


  warnings.warn(CDeprecationWarning(W_PICKLE_DEPRECATED))

[2018-05-05 07:45:05,620: WARNING/MainProcess] /home/wfq/python27/lib/python2.7/site-packages/celery-3.1.25-py2.7.egg/celery/apps/worker.py:161: CDeprecationWarning: 
Starting from version 3.2 Celery will refuse to accept pickle by default.

The pickle serializer is a security concern as it may give attackers
the ability to execute any command.  It's important to secure
your broker from unauthorized access when using pickle, so we think
that enabling pickle should require a deliberate action and not be
the default choice.

If you depend on pickle then you should set a setting to disable this
warning and to be sure that everything will continue working
when you upgrade to Celery 3.2::

    CELERY_ACCEPT_CONTENT = ['pickle', 'json', 'msgpack', 'yaml']

You must only enable the serializers that you will actually use.


  warnings.warn(CDeprecationWarning(W_PICKLE_DEPRECATED))


 -------------- celery@ubuntu v3.1.25 (Cipater)
---- **** ----- 
--- * ***  * -- Linux-4.4.0-31-generic-x86_64-with-debian-jessie-sid
-- * - **** --- 
- ** ---------- [config]
- ** ---------- .> app:         default:0x7f27e12d40d0 (djcelery.loaders.DjangoLoader)
- ** ---------- .> transport:   redis://192.168.174.132:6379/0
- ** ---------- .> results:     redis://192.168.174.132:6379/0
- *** --- * --- .> concurrency: 2 (prefork)
-- ******* ---- 
--- ***** ----- [queues]
 -------------- .> celery           exchange=celery(direct) key=celery


[tasks]
  . asb.tasks.start_mis1c10
  . asb.tasks.test_add

[2018-05-05 07:45:05,722: INFO/MainProcess] Connected to redis://192.168.174.132:6379/0
[2018-05-05 07:45:05,732: INFO/MainProcess] mingle: searching for neighbors
[2018-05-05 07:45:06,741: INFO/MainProcess] mingle: all alone
/home/wfq/python27/lib/python2.7/site-packages/django_celery-3.2.2-py2.7.egg/djcelery/loaders.py:133: UserWarning: Using settings.DEBUG leads to a memory leak, never use this setting in production environments!
  warn('Using settings.DEBUG leads to a memory leak, never '

[2018-05-05 07:45:06,772: WARNING/MainProcess] /home/wfq/python27/lib/python2.7/site-packages/django_celery-3.2.2-py2.7.egg/djcelery/loaders.py:133: UserWarning: Using settings.DEBUG leads to a memory leak, never use this setting in production environments!
  warn('Using settings.DEBUG leads to a memory leak, never '

[2018-05-05 07:45:06,777: WARNING/MainProcess] celery@ubuntu ready.

(env27)wfq@ubuntu:~/ops$ 
(env27)wfq@ubuntu:~/ops$ ps -ef | grep celery
wfq       28208  27634  2 15:45 pts/4    00:00:01 python manage.py celery worker -c 2 --loglevel=info
wfq       28213  28208  0 15:45 pts/4    00:00:00 python manage.py celery worker -c 2 --loglevel=info
wfq       28214  28208  0 15:45 pts/4    00:00:00 python manage.py celery worker -c 2 --loglevel=info
wfq       28216  27634  0 15:45 pts/4    00:00:00 grep --color=auto celery
(env27)wfq@ubuntu:~/ops$
4. 启动ops
(env27)wfq@ubuntu:~/ops$ python manage.py runserver 0.0.0.0:8000&
(env27)wfq@ubuntu:~/ops$ python manage.py runserver 0.0.0.0:8000&
[3] 28218
(env27)wfq@ubuntu:~/ops$ Performing system checks...

System check identified no issues (0 silenced).
May 05, 2018 - 07:47:16
Django version 1.8.3, using settings 'ops.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
^M
(env27)wfq@ubuntu:~/ops$ 

或者windows本机通过pycharm客户端启动ops,方便debug调试

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐