【发布时间】:2016-12-15 14:15:46
【问题描述】:
我已经关注了 json 文件。我正在尝试使用 jq 更新此文件中的几个属性
{
"href" : "http://localhost:8080/api/v1/clusters/ambarihbase/configurations?type=hbase-site&tag=TOPOLOGY_RESOLVED",
"items" : [
{
"href" : "http://localhost:8080/api/v1/clusters/ambarihbase/configurations?type=hbase-site&tag=TOPOLOGY_RESOLVED",
"tag" : "TOPOLOGY_RESOLVED",
"type" : "hbase-site",
"version" : 2,
"Config" : {
"cluster_name" : "ambarihbase",
"stack_id" : "HDP-2.5"
},
"properties" : {
"dfs.domain.socket.path" : "/var/lib/hadoop-hdfs/dn_socket",
"dfs.support.append" : "false",
"hbase.bucketcache.combinedcache.enabled" : "true",
"hbase.bucketcache.ioengine" : "file:/mnt/hbase/cache.data",
"hbase.bucketcache.percentage.in.combinedcache" : "",
"hbase.bucketcache.size" : "81920",
"hbase.bulkload.staging.dir" : "/apps/hbase/staging",
"hbase.client.keyvalue.maxsize" : "1048576",
"hbase.client.retries.number" : "35",
"hbase.client.scanner.caching" : "100",
"hbase.cluster.distributed" : "true",
"hbase.coprocessor.master.classes" : "",
"hbase.coprocessor.region.classes" : "org.apache.hadoop.hbase.security.access.SecureBulkLoadEndpoint",
"hbase.defaults.for.version.skip" : "true",
"hbase.fs.shutdown.hook.wait" : "600000",
"hbase.hregion.majorcompaction" : "0",
"hbase.hregion.majorcompaction.jitter" : "0.50",
"hbase.hregion.max.filesize" : "3221225472",
"hbase.hregion.memstore.block.multiplier" : "4",
"hbase.hregion.memstore.flush.size" : "134217728",
"hbase.hregion.memstore.mslab.enabled" : "true",
"hbase.hstore.blockingStoreFiles" : "100",
"hbase.hstore.compaction.max" : "10",
"hbase.hstore.compaction.max.size" : "10737418240",
"hbase.hstore.compactionThreshold" : "3",
"hbase.local.dir" : "${hbase.tmp.dir}/local",
"hbase.master.distributed.log.splitting" : "true",
"hbase.master.info.bindAddress" : "0.0.0.0",
"hbase.master.info.port" : "16010",
"hbase.master.port" : "16000",
"hbase.master.ui.readonly" : "false",
"hbase.region.server.rpc.scheduler.factory.class" : "org.apache.hadoop.hbase.ipc.PhoenixRpcSchedulerFactory",
"hbase.regionserver.global.memstore.size" : "0.4",
"hbase.regionserver.handler.count" : "100",
"hbase.regionserver.hlog.blocksize" : "134217728",
"hbase.regionserver.info.port" : "16030",
"hbase.regionserver.optionalcacheflushinterval" : "0",
"hbase.regionserver.port" : "16020",
"hbase.regionserver.wal.codec" : "org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec",
"hbase.rest.port" : "8090",
"hbase.rootdir" : "/hbase",
"hbase.rpc.protection" : "authentication",
"hbase.rpc.timeout" : "90000",
"hbase.rs.cacheblocksonwrite" : "true",
"hbase.security.authentication" : "simple",
"hbase.security.authorization" : "false",
"hbase.shutdown.hook" : "true",
"hbase.superuser" : "hbase",
"hbase.tmp.dir" : "/tmp/hbase-${user.name}",
"hbase.zookeeper.property.clientPort" : "2181",
"hbase.zookeeper.useMulti" : "true",
"hfile.block.cache.size" : "0.40",
"hfile.index.block.max.size" : "131072",
"io.storefile.bloom.block.size" : "131072",
"phoenix.functions.allowUserDefinedFunctions" : "true",
"phoenix.query.timeoutMs" : "60000",
"zookeeper.recovery.retry" : "6",
"zookeeper.session.timeout" : "120000",
"zookeeper.znode.parent" : "/hbase-unsecure"
}
}
]
}
我想更新hbase.hregion.max.filesize所以我尝试了以下
cat initial.json |
jq 'to_entries |
map(if .items[0].properties.key == "hfile.block.cache.size"
then . + {"value":"0.20"}
else .
end
) |
from_entries'
输出原始文件但没有更新hfile.block.cache.size
谢谢
【问题讨论】: