
私はApache Geode ノードすべての作業は Linux CLI 経由で行われます。通常、設定ファイルを編集すると (VIM を使用)、テキストは次のようになります。
"nodes": {"long_UUID_here": {"node_uuid": "another_long_string_here", pair_uuid:" null,
"is_admin_node": false, "ip_address": "ip-or-fqnd.domain.com", "preferred_addresses": {},
"node_name": shortname.domain.com", "membership_state": null, "region": null}
...そしてそれは1つノード。多くの場合、複数のノードがあり、テキストがすべてまとまり、読みにくい大きな混乱状態になります。次のようにファイルを表示および編集できれば、この作業は大幅に簡単になります。
"nodes": {
"long_UUID_here": {
"node_uuid": "another_long_string_here",
"pair_uuid:" null,
"is_admin_node": false,
"ip_address": "ip-or-fqnd.domain.com",
"preferred_addresses": {},
"node_name": shortname.domain.com",
"membership_state": null,
"region": null
}
これが可能であることは知っていますし、以前にも見たことがありますが、どのように行われるのかはわかりません。
更新: これはSLESアプライアンス(インターネットにアクセスできないことが多い)なので、アプリをインストールできない、 のようなjq
答え1
DevOps の同僚がsed
+ regEx +を使用してこれを行う方法を教えてくれましたjson.tool
:
`echo sed -nre "/clusterMembership/ s/^[^']+'([^']+)','([^']+)'.*/\2/p" /path/to/file/here/node.file.config | python -m json.tool