小编use*_*639的帖子

perl中的json解码

我在文件sample.txt中有一个json

我想通过指定解码整个json和打印键值.我的每个代码是

#!/usr/bin/perl
use JSON; 
use Data::Dumper; 
use JSON::XS qw( decode_json );

open (han1, "sample.txt") or die "can not read this file ";
@array1 = <han1>; 
$tst =  $array1[0];
$text = decode_json $tst; 
print Dumper($text);
Run Code Online (Sandbox Code Playgroud)

我有一个json名称'messages_ready'的密钥.我想打印'messages_ready'的价值..

我的json如下

[
    {
        "arguments": {},
        "auto_delete": false,
        "backing_queue_status": {
            "avg_ack_egress_rate": 55.02128728993393,
            "avg_ack_ingress_rate": 55.02128728993393,
            "avg_egress_rate": 55.02128728993393,
            "avg_ingress_rate": 109.64602476156203,
            "delta": [
                "delta",
                0,
                0,
                0
            ],
            "len": 6465,
            "next_seq_id": 7847104,
            "pending_acks": 4,
            "persistent_count": 0,
            "q1": 0,
            "q2": 0,
            "q3": 0,
            "q4": 6465,
            "ram_ack_count": 4,
            "ram_msg_count": 6465, …
Run Code Online (Sandbox Code Playgroud)

linux perl json

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

启动配置更新 terraform 后实例未刷新

我正在尝试更新启动配置用户数据。但是在申请后,启动配置正在创建和更新 ASG。但是正在运行的实例仍然带有旧的用户数据。为什么这样 ?

下面是启动配置和 ASG 块。

resource "aws_launch_configuration" "BackEndWebLaunchConfig" {
        name_prefix             = "${var.component_name}-BackEndWebLaunchConfig"
        user_data               = file("user_data/${terraform.workspace}/vision-be-user-data.sh")
        image_id                = var.ASLCWEBAPPSAMI
        instance_type           = var.ASGWebAppsInstanceType
        key_name                = var.ssh_key_name
        security_groups         = [module.vpc.sgssh, aws_security_group.vision_backend_EC2SG.id]
        root_block_device  {
            volume_size         = var.EC2_EBS_SIZE
            volume_type         = "standard"
            encrypted           = true
        }
        #iam_instance_profile    = var.EC2_instance_profile
        associate_public_ip_address = false 
        lifecycle       { 
            create_before_destroy = true 
            }
        
}

resource "aws_autoscaling_group" "vision_asg" {
        name                      = "${var.component_name}-BackEnd-ASG-TF"
        max_size                  = var.ASGWEBAPPSMaxSize
        min_size                  = var.ASGWEBAPPSMinSize
        health_check_grace_period = 300
        force_delete              = true
        health_check_type         = "ELB"
        desired_capacity          = var.ASGWEBAPPSDesiredSize
        launch_configuration …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services terraform terraform-provider-aws

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