小编esw*_*son的帖子

如何将web套接字与django wsgi集成

我们有一个非常复杂的Django应用程序,当前由apache/mod_wsgi提供,并部署在AWS ELB负载均衡器后面的多个AWS EC2实例上.客户端应用程序使用AJAX与服务器交互.他们还定期轮询服务器以检索其状态的通知和更新.我们希望删除轮询并使用网络套接字将其替换为"push".

因为任意实例处理来自客户端的Web套接字请求并保留这些Web套接字,并且因为我们希望将数据推送到可能不在提供推送源数据的同一实例上的客户端,所以我们需要一种方法来将数据路由到适当的实例,然后从该实例到适当的客户端Web套接字.

我们意识到apache/mod_wsgi与web套接字不兼容,并计划用nginx/gunicorn替换这些组件并使用gevent-websocket worker.但是,如果多个工作进程中的一个接收来自客户端的请求以建立Web套接字,并且如果工作进程的生命周期由主要的gunicorn进程控制,则不清楚其他工作进程如何处理,或者实际上是非枪支进程可以将数据发送到这些Web套接字.

具体情况是这样的:发出HTTP请求的用户被定向到一个EC2实例(主机),并且期望的行为是将数据发送给在完全不同的实例中打开web套接字的另一个用户.可以容易地设想一种系统,其中在每个实例上运行的消息代理(例如,rabbitmq)可以被发送包含要通过web套接字发送到连接到该实例的客户端的数据的消息.但是这些消息的处理程序如何访问在gunicorn的工作进程中收到的Web套接字?高级python Web套接字对象创建gevent-websocket并且可供工作人员使用,不能被pickle(它们是不支持pickle的实例方法),因此它们不能轻易地被工作进程共享到一些长时间运行的外部处理.

事实上,这个问题的根源在于如何通过外部进程访问由客户端的HTTP请求启动并由诸如gunicorn等服务器中的WSGI处理程序处理的Web套接字?用于处理HTTP请求的gunicorn工作进程似乎是正确的,它会产生长时间运行的线程以挂起到Web套接字并支持处理来自其他进程的消息,以便将消息发送到通过这些工作者连接的Web套接字流程.

任何人都可以解释一下Web套接字和基于WSGI的HTTP请求处理程序如何在我描述的环境中相互影响?

谢谢.

django wsgi websocket gevent gunicorn

8
推荐指数
1
解决办法
2059
查看次数

如何防止重新发出重复的"空监视文件列表.禁用"消息

我在logback.xml配置了logback:http://pastebin.com/KuqUEkXy .

每分钟,我都会看到表单中发出的日志消息:

18:26:21,486 | -INFO in ReconfigureOnChangeTask(born:1478715201485) - 空监视文件列表.禁用

为什么会这样,我怎么能摆脱这些?

logback

7
推荐指数
4
解决办法
3572
查看次数

Vagrant:未知的配置部分'omnibus',但安装了vagrant-omnibus插件

在安装了最新的ChefDK之后,我按照http://berkshelf.com/上的说明进行 操作(从这里:http://downloads.getchef.com/chef-dk/mac/#/).当我做"流浪汉"时,我收到错误:

Vagrant:
* Unknown configuration section 'omnibus'.
Run Code Online (Sandbox Code Playgroud)

各种帖子(例如基本图像上的Vagrant Install chef-client)表明这意味着没有安装vagrant-omnibus插件.在我的情况下,我已经安装了它."vagrant plugin list"显示:

vagrant-berkshelf (2.0.1)
  - Version Constraint: 2.0.1
vagrant-login (1.0.1, system)
vagrant-omnibus (1.4.1)
vagrant-share (1.1.1, system)
Run Code Online (Sandbox Code Playgroud)

有关如何让这个示例菜谱在一个用"vagrant up"启动的新VM实例上运行的任何建议?

chef-infra vagrant berkshelf

4
推荐指数
1
解决办法
4821
查看次数

如何从Apache Cassandra CommitLogReplayException中恢复

运行apache-cassandra 3.3时,我意外关闭了Mac OS X. 在新的引导加载中重新启动cassandra时,出现以下错误:

INFO  15:25:15 Replaying /Users/eswenson/opt/apache-cassandra-3.5/bin/../data/commitlog/CommitLog-6-1461717351786.log, /Users/eswenson/opt/apache-cassandra-3.5/bin/../data/commitlog/CommitLog-6-1461717351787.log, /Users/eswenson/opt/apache-cassandra-3.5/bin/../data/commitlog/CommitLog-6-1461942807785.log, /Users/eswenson/opt/apache-cassandra-3.5/bin/../data/commitlog/CommitLog-6-1461943004975.log
ERROR 15:25:15 Exiting due to error while processing commit log during initialization.
org.apache.cassandra.db.commitlog.CommitLogReplayer$CommitLogReplayException: Encountered bad header at position 542295 of commit log /Users/eswenson/opt/apache-cassandra-3.5/bin/../data/commitlog/CommitLog-6-1461717351786.log, with bad position but valid CRC
        at org.apache.cassandra.db.commitlog.CommitLogReplayer.handleReplayError(CommitLogReplayer.java:611) [apache-cassandra-3.5.jar:3.5]
        at org.apache.cassandra.db.commitlog.SegmentReader$SegmentIterator.computeNext(SegmentReader.java:105) [apache-cassandra-3.5.jar:3.5]
        at org.apache.cassandra.db.commitlog.SegmentReader$SegmentIterator.computeNext(SegmentReader.java:78) [apache-cassandra-3.5.jar:3.5]
        at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143) [guava-18.0.jar:na]
        at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138) [guava-18.0.jar:na]
        at org.apache.cassandra.db.commitlog.CommitLogReplayer.recover(CommitLogReplayer.java:399) [apache-cassandra-3.5.jar:3.5]
        at org.apache.cassandra.db.commitlog.CommitLogReplayer.recover(CommitLogReplayer.java:236) [apache-cassandra-3.5.jar:3.5]
        at org.apache.cassandra.db.commitlog.CommitLog.recover(CommitLog.java:192) [apache-cassandra-3.5.jar:3.5]
        at org.apache.cassandra.db.commitlog.CommitLog.recover(CommitLog.java:172) [apache-cassandra-3.5.jar:3.5]
        at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:283) [apache-cassandra-3.5.jar:3.5]
        at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:551) [apache-cassandra-3.5.jar:3.5]
        at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:680) [apache-cassandra-3.5.jar:3.5]
Run Code Online (Sandbox Code Playgroud)

我搜索堆栈溢出和谷歌,并没有找到相同问题的帖子.我找到了问题https://issues.apache.org/jira/browse/CASSANDRA-9749,这是相关的,但是这个问题被标记为已解决,并且与检测到问题后继续执行有关,而不是因为异常而失败. …

cassandra replay

4
推荐指数
1
解决办法
5228
查看次数

Cassandra Mutation too Large, for small insert

I'm getting these errors:

java.lang.IllegalArgumentException: Mutation of 16.000MiB is too large for the maximum size of 16.000MiB

in Apache Cassandra 3.x. I'm doing inserts of 4MB or 8MB blobs, but not anything greater than 8MB. Why am I hitting the 16MB limit? Is Cassandra batching up multiple writes (inserts) and creating a "mutation" that is too large? (If so, why would it do that, since the configured limit is 8MB?)

关于突变的文献很少-只是说突变是插入或删除。如何防止这些错误?

cassandra mutation

2
推荐指数
1
解决办法
1180
查看次数