小编moh*_*han的帖子

在nginx中添加和使用标头(HTTP)

我使用的是两个系统(两个都是nginx负载均衡器,一个是备份).我想添加和使用几个http自定义标头.请给出你的建议

例如

upstream upstream0 {
    #list of upstream servers
    server backend:80;
    server backup_load_balancer:777 backup;
    #healthcheck
}

server {
    listen 80;
    #Add custom header about the port and protocol  (http or https)
    server_name _;

    location / {
        # is included since links are not allowed in the post
        proxy_pass "http://upstream0;"
    }
}
Run Code Online (Sandbox Code Playgroud)

//备份系统

server {
    listen 777;
    server_name _;
    #doing some other extra stuff
    #use port and protocol to direct
}
Run Code Online (Sandbox Code Playgroud)

谢谢

http nginx

42
推荐指数
2
解决办法
13万
查看次数

如何从数据框表面绘图/ 3d图?

我是新来的pandasmatplotlib.无法准确引用绘制我DataFrame的模式如下

schema = StructType([
StructField("x", IntegerType(), True),
StructField("y", IntegerType(), True),
StructField("z", IntegerType(), True)])
Run Code Online (Sandbox Code Playgroud)

喜欢绘制3d图形wrt x,y和z

这是我使用的示例代码

import matplotlib.pyplot as pltt

dfSpark = sqlContext.createDataFrame(tupleRangeRDD, schema) // reading as spark df
df = dfSpark.toPandas()
fig = pltt.figure();
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(df['x'], df['y'], df['z']) 
Run Code Online (Sandbox Code Playgroud)

我得到一个空图形图.肯定遗漏了什么.有什么指针吗?

-谢谢

请求-1:打印df

def print_full(x):
pd.set_option('display.max_rows', len(x))
print(x)
pd.reset_option('display.max_rows')


print_full(df)
Run Code Online (Sandbox Code Playgroud)

前十名的结果

         x    y       z
0      301  301      10
1      300  301      16
2      300  300       6
3      299  301      30
4      299 …
Run Code Online (Sandbox Code Playgroud)

python numpy matplotlib dataframe pandas

15
推荐指数
1
解决办法
3万
查看次数

通过linux命令向端口发送数据

我想通过 Linux 命令将简单数据(比如“hello world”)发送到另一个系统(以及特定的端口号)。我正在寻找类似于客户端程序的命令?谁能帮我吗?

我尝试使用 CURL 但没有正确理解。如果在 CUrl 中可能的话你能举一些例子吗?

提前致谢

linux curl client-server client-side sendmessage

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

AWS Lambda中的Boto3 S3列表对象抛出错误

lambda中的代码:

import boto3

def lambda_handler(event, context):
    s3_client = boto3.resource('s3')
    mybucket = s3_client.Bucket('bucket-name')
    for object in mybucket.objects.all():
       print(object)

    for key in s3_client.list_objects(Bucket='bucket-name')['Contents']:
       print(key['Key'])'
Run Code Online (Sandbox Code Playgroud)

第一个“ for”块列出存储桶中的所有键,但是第二个“ for”块引发以下错误。

's3.Service Resource' object has no attribute 'list_objects' : AttributeError
Run Code Online (Sandbox Code Playgroud)

根据http://boto3.readthedocs.io/en/latest/reference/services/s3.html#S3.Client.list_buckets,这没有任何意义。关于可能是什么问题的任何提示?我使用了python 2.7和python 3.6

python amazon-s3 amazon-web-services boto3 aws-lambda

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