2
1

More than 3 years have passed since last update.

uwsgi の uwsgi プロトコル通信を uwsgi-tools で確認する

Posted at

メモ。

以下のよう uwsgi を実行すると uwsgi プロトコルによる通信が出来る。

Putting behind a full webserver

$uwsgi --socket 127.0.0.1:3031 --wsgi-file foobar.py --master --processes 4 --threads 2 --stats 127.0.0.1:9191

ただし、上記のような場合、クライアントからの接続テストが面倒そうだなと感じていた。

ググると以下の Github issue を発見

how to test uwsgi unix socket ? #1443

上記に書いてあるように uwsgi-tools というのが便利みたいなので使ってみた。

andreif/uwsgi-tools

インストール

インストールは pip で可能

uwsgi-tools 1.1.1

$pip install uwsgi-tools

使い方

基本的な使い方は README に書いてある。

andreif/uwsgi-tools

localhost で uwsgi プロトコルをリッスンしている場合、以下のようにして確認出来る。

$uwsgi_curl localhost:3031
HTTP/1.1 200 OK
Content-Type: text/html

リモートホストの場合にも以下のようにして接続テストが出来る。

$uwsgi_curl hogefuga:3031
HTTP/1.1 200 OK
Content-Type: text/html

参考

import socketをしており、socket 通信をしている模様。

The uwsgi Protocol

The protocol works mainly via TCP but the master process can bind to a UDP Unicast/Multicast for The embedded SNMP server or cluster management/messaging requests.

以下あたりが勉強になりそう

pythonでsocket通信を勉強しよう

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1