From 5cbb9706d0e866e9caa80302c319a67a28651136 Mon Sep 17 00:00:00 2001 From: banana Date: Wed, 10 Jul 2019 16:50:32 +0100 Subject: [PATCH 01/40] pulled down riak 3.0 with riak_stat as a dependency. exoskeleton too internal --- apps/riak/src/riak.app.src | 1 + rebar.config | 5 ++-- rebar.lock | 54 ++++++++++++++++++++++++++------------ 3 files changed, 41 insertions(+), 19 deletions(-) diff --git a/apps/riak/src/riak.app.src b/apps/riak/src/riak.app.src index 9a824dcb7..650f8b385 100644 --- a/apps/riak/src/riak.app.src +++ b/apps/riak/src/riak.app.src @@ -13,6 +13,7 @@ os_mon, crypto, riak, + riak_stat, cuttlefish, runtime_tools, lager_syslog, diff --git a/rebar.config b/rebar.config index c0412779a..c1f067c19 100644 --- a/rebar.config +++ b/rebar.config @@ -16,8 +16,9 @@ {riak_kv, {git, "git://github.com/basho/riak_kv.git", {branch, "develop-3.0"}}}, {riak_auth_mods, {git, "git://github.com/basho/riak_auth_mods.git", {branch, "develop-3.0"}}}, {riak_repl, {git, "git://github.com/basho/riak_repl.git", {branch, "develop-3.0"}}}, - {yokozuna, {git, "git://github.com/basho/yokozuna.git", {branch, "develop-3.0"}}} - ]}. + {yokozuna, {git, "git://github.com/basho/yokozuna.git", {branch, "develop-3.0"}}}, + {riak_stat, {git, "https://github.com/bet365/riak_stat.git", {branch, "develop-2.2.8-stats-work"}}} +]}. {project_plugins, [ {rebar3_cuttlefish, {git, "https://github.com/martincox/rebar3_cuttlefish", {branch, "fix/output-dir-awareness"}}} diff --git a/rebar.lock b/rebar.lock index c5f2122bc..d7d2addda 100644 --- a/rebar.lock +++ b/rebar.lock @@ -3,7 +3,10 @@ {git,"git://github.com/basho/basho_stats.git", {ref,"176dee0537b5b3aff57646a7379d435ad990488e"}}, 3}, - {<<"bear">>,{pkg,<<"bear">>,<<"0.8.7">>},5}, + {<<"bear">>, + {git,"git://github.com/basho/bear.git", + {ref,"da820a13c607c3f816ee8b83c587266da5389761"}}, + 3}, {<<"bitcask">>, {git,"git://github.com/basho/bitcask.git", {ref,"fa6e5166de683a351ca63f97b6a08c9b815affab"}}, @@ -28,6 +31,10 @@ {git,"git://github.com/basho/ebloom.git", {ref,"46207eaa38412d1db7913e18a0231efd49372a4a"}}, 1}, + {<<"edown">>, + {git,"git://github.com/basho/edown.git", + {ref,"754be25f71a04099c83f3ffdff268e70beeb0021"}}, + 3}, {<<"eleveldb">>, {git,"git://github.com/basho/eleveldb.git", {ref,"55e67e0a611b036483ec446a240c94d7f20d6970"}}, @@ -40,8 +47,14 @@ {git,"git://github.com/seancribbs/eunit_formatters", {ref,"473e0cd89bf5608e97886a3bdf9047a16edc88f0"}}, 1}, - {<<"exometer_core">>,{pkg,<<"exometer_core">>,<<"1.5.7">>},3}, - {<<"folsom">>,{pkg,<<"folsom">>,<<"0.8.7">>},4}, + {<<"exometer_core">>, + {git,"git://github.com/basho/exometer_core.git", + {ref,"4c43c777266fbf95cb83d2cf50afc555e5e3a7ec"}}, + 1}, + {<<"folsom">>, + {git,"git://github.com/basho/folsom.git", + {ref,"72944523b6467c9f7add5f1c96dd5020424a2681"}}, + 2}, {<<"fuse">>, {git,"https://github.com/jlouis/fuse.git", {ref,"21c6e52ced3af294f2fe636039106068da12eeeb"}}, @@ -55,7 +68,6 @@ {git,"git://github.com/DeadZen/goldrush.git", {ref,"212299233c7e7eb63a97be2777e1c05ebaa58dbe"}}, 2}, - {<<"hut">>,{pkg,<<"hut">>,<<"1.2.1">>},4}, {<<"hyper">>, {git,"git://github.com/basho/hyper", {ref,"dc9f8754b8fb0961c2e0cccf7ac2c49c46828487"}}, @@ -66,7 +78,7 @@ 1}, {<<"kv_index_tictactree">>, {git,"https://github.com/martinsumner/kv_index_tictactree.git", - {ref,"07053dcbf6006c1ad1c2e7837c908e28a26ee1f7"}}, + {ref,"55b6a7dd301e948b4518bcb57c6624f3bafc0053"}}, 1}, {<<"kvc">>, {git,"git://github.com/etrepum/kvc.git", @@ -82,17 +94,24 @@ 0}, {<<"leveled">>, {git,"https://github.com/martinsumner/leveled.git", - {ref,"984a2aba5a121b90e4ddbfdf97c88604e5f0ff49"}}, + {ref,"b2d4d766cddf7c07ee2fbe51245c1e1164a9aed0"}}, 1}, {<<"lz4">>, {git,"https://github.com/szktty/erlang-lz4", {ref,"6bc5efe93bab327788bcde24374f16044b549dd8"}}, 2}, + {<<"meck">>, + {git,"git://github.com/basho/meck.git", + {ref,"dde759050eff19a1a80fd854d7375174b191665d"}}, + 3}, {<<"mochiweb">>, {git,"git://github.com/mochi/mochiweb.git", {ref,"23dc11959affd9b0849c2ac0ff4200c1c82aa80c"}}, 2}, - {<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.0">>},4}, + {<<"parse_trans">>, + {git,"git://github.com/basho/parse_trans.git", + {ref,"4517dfc096908995b479d6d9ed8284315e68b076"}}, + 2}, {<<"pbkdf2">>, {git,"git://github.com/basho/erlang-pbkdf2.git", {ref,"34b5f716fa3ec89ede36d009f7cc8c47bd019dd7"}}, @@ -107,7 +126,7 @@ 1}, {<<"riak_api">>, {git,"git://github.com/basho/riak_api.git", - {ref,"a2aff12fd1d134a2dbdb340a3ba970cfe14e33f2"}}, + {ref,"c2b2a6ea03bb05d0020a352634d67036f9a10d15"}}, 1}, {<<"riak_auth_mods">>, {git,"git://github.com/basho/riak_auth_mods.git", @@ -127,7 +146,7 @@ 3}, {<<"riak_kv">>, {git,"git://github.com/basho/riak_kv.git", - {ref,"a3a375deae2d85d2ddabe4dbbd9d1267a5e80d2f"}}, + {ref,"b9b9d62ae0084abccfcfdb2fd4fa701d77e52ec2"}}, 0}, {<<"riak_pb">>, {git,"git://github.com/basho/riak_pb.git", @@ -145,12 +164,19 @@ {git,"git://github.com/basho/riak_repl_pb_api.git", {ref,"6c9ce4abd1170ea77c2267addc18e0c5ad72bb1e"}}, 1}, + {<<"riak_stat">>, + {git,"https://github.com/bet365/riak_stat.git", + {ref,"b60d0c9273a408700c1b6b58eb4ca10631b1ebd2"}}, + 0}, {<<"riak_sysmon">>,{pkg,<<"riak_sysmon">>,<<"2.1.7">>},3}, {<<"riakc">>, {git,"git://github.com/basho/riak-erlang-client", {ref,"a47f7a01bac76d33f32c907f4a3a675c66239d03"}}, 1}, - {<<"setup">>,{pkg,<<"setup">>,<<"2.0.2">>},4}, + {<<"setup">>, + {git,"git://github.com/basho/setup.git", + {ref,"51ee7c9f64d2bbe9dcbb58c278e8fbfd4d0ca5e2"}}, + 2}, {<<"sext">>, {git,"git://github.com/uwiger/sext.git", {ref,"615eebcf975ec4b4561c6f2b2bc433dabdb2be0f"}}, @@ -173,12 +199,6 @@ 0}]}. [ {pkg_hash,[ - {<<"bear">>, <<"16264309AE5D005D03718A5C82641FCC259C9E8F09ADEB6FD79CA4271168656F">>}, - {<<"exometer_core">>, <<"AB97E34A5D69AB14E6AE161DB4CCA5B5E655E635B842F830EE6AB2CBFCFDC30A">>}, - {<<"folsom">>, <<"A885F0AEEE4C84270954C88A55A5A473D6B2C7493E32FFDC5765412DD555A951">>}, {<<"gen_fsm_compat">>, <<"5903549F67D595F58A7101154CBE0FDD46955FBFBE40813F1E53C23A970FF5F4">>}, - {<<"hut">>, <<"08D46679523043424870723923971889E8A34D63B2F946A35B46CF921D1236E7">>}, - {<<"parse_trans">>, <<"09765507A3C7590A784615CFD421D101AEC25098D50B89D7AA1D66646BC571C1">>}, - {<<"riak_sysmon">>, <<"AF420DF0F7569E1F12BCD465745164CB6189EB93F118D5CDB3F90FEB3F8BF47D">>}, - {<<"setup">>, <<"1203F4CDA11306C2E34434244576DED0A7BBFB0908D9A572356C809BD0CDF085">>}]} + {<<"riak_sysmon">>, <<"AF420DF0F7569E1F12BCD465745164CB6189EB93F118D5CDB3F90FEB3F8BF47D">>}]} ]. From a403eea993010a4dab30af617e53d4aa639dcee3 Mon Sep 17 00:00:00 2001 From: banana Date: Mon, 15 Jul 2019 16:53:32 +0100 Subject: [PATCH 02/40] changed riak-admin to support riak_stat functions --- rel/files/riak-admin | 83 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 77 insertions(+), 6 deletions(-) diff --git a/rel/files/riak-admin b/rel/files/riak-admin index 68fc9efc0..9875bfd3b 100755 --- a/rel/files/riak-admin +++ b/rel/files/riak-admin @@ -28,23 +28,93 @@ stat_admin() case "$1" in show) shift - relx_nodetool rpc riak_core_console stat_show "$*" + node_up_check + NODETOOL rpc riak_core_console stat_enabled "$*" ;; - info) + show-disabled) shift - relx_nodetool rpc riak_core_console stat_info "$*" + node_up_check + NODETOOL rpc riak_core_console stat_disabled "$*" + ;; + show-0) + shift + node_up_check + NODETOOL rpc riak_core_console stat_0 "$*" + ;; + disable-0) + shift + node_up_check + NODETOOL rpc riak_core_console stat_disable_0 "$*" + ;; + info) + shift + node_up_check + NODETOOL rpc riak_core_console stat_info "$*" ;; enable) shift - relx_nodetool rpc riak_core_console stat_enable "$*" + node_up_check + NODETOOL rpc riak_core_console stat_enable "$*" ;; disable) shift - relx_nodetool rpc riak_core_console stat_disable "$*" + node_up_check + NODETOOL rpc riak_core_console stat_disable "$*" ;; reset) shift - relx_nodetool rpc riak_core_console stat_reset "$*" + node_up_check + NODETOOL rpc riak_core_console stat_reset "$*" + ;; + load-profile) + shift + node_up_check + NODETOOL rpc riak_core_console load_profile "$*" + ;; + save-profile) + shift + node_up_check + NODETOOL rpc riak_core_console add_profile "$*" + ;; + remove-profile) + shift + node_up_check + NODETOOL rpc riak_core_console remove_profile "$*" + ;; + reset-profile) + shift + node_up_check + NODETOOL rpc riak_core_console reset_profile "$*" + ;; + enable-udp) + shift + node_up_check + NODETOOL rpc riak_core_console enable_udp "$*" + ;; + enable-http) + shift + node_up_check + NODETOOL rpc riak_core_console enable_http "$*" + ;; + disable-udp) + shift + node_up_check + NODETOOL rpc riak_core_console disable_udp "$*" + ;; + disable-http) + shift + node_up_check + NODETOOL rpc riak_core_console disable_http "$*" + ;; + change-port) + shift + node_up_check + NODETOOL rpc riak_core_console change_port "$*" + ;; + restart-port) + shift + node_up_check + NODETOOL rpc riak_core_console restart_port "$*" ;; help) shift @@ -70,6 +140,7 @@ stat_admin() esac } + stat_help() { echo "\ From 3040478b90d615170f322dd3fa23236fbc72184d Mon Sep 17 00:00:00 2001 From: banana Date: Mon, 22 Jul 2019 13:35:15 +0100 Subject: [PATCH 03/40] changed the bash script in riak-admin to rpc to new functions in riak_core_console, functions for exoskeleskin, riak_stat: consol commands, profile commands and generic admin commands. Updated the riak-admin stat --help with more information on profiles and exoskeleskin functions --- rel/files/riak-admin | 77 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 65 insertions(+), 12 deletions(-) diff --git a/rel/files/riak-admin b/rel/files/riak-admin index 9875bfd3b..e6465cc3a 100755 --- a/rel/files/riak-admin +++ b/rel/files/riak-admin @@ -86,35 +86,35 @@ stat_admin() node_up_check NODETOOL rpc riak_core_console reset_profile "$*" ;; - enable-udp) + enable-metadata) shift node_up_check - NODETOOL rpc riak_core_console enable_udp "$*" + NODETOOL rpc riak_core_console enable_metadata "$*" ;; - enable-http) + disable-port) shift node_up_check - NODETOOL rpc riak_core_console enable_http "$*" + NODETOOL rpc riak_core_console disable_port "$*" ;; - disable-udp) + setup-port) shift node_up_check - NODETOOL rpc riak_core_console disable_udp "$*" + NODETOOL rpc riak_core_console setup_port "$*" ;; - disable-http) + enable-data-persistence) shift node_up_check - NODETOOL rpc riak_core_console disable_http "$*" + NODETOOL rpc riak_core_console yes_data_persist "$*" ;; - change-port) + disable-data-persistence) shift node_up_check - NODETOOL rpc riak_core_console change_port "$*" + NODETOOL rpc riak_core_console no_data_persist "$*" ;; - restart-port) + data-persist-profile) shift node_up_check - NODETOOL rpc riak_core_console restart_port "$*" + NODETOOL rpc riak_core_console pro_data_persist "$*" ;; help) shift @@ -160,6 +160,9 @@ Quoting is permitted. Use \`$SCRIPT stat help \` for more details. show Show the value(s) of a specific entry or entries + show-disabled Show the disabled value(s) of a specific entry/entries + show-0 Show the stats that are not updating of a specific entry + disable-0 Disable the stats that are not updating of an entry enable Enable entry or entries disable Disable entry or entries reset Reset entry or entries @@ -169,6 +172,56 @@ Use \`$SCRIPT stat help \` for more details. | -status | -timestamp | -options | -ref | -datapoints ] + + Profiles : + + Profiles are the specific set up of stats, whether - enabled, disabled or unregistered, it + is recorded in the profile upon saving, loading a profile remains persisted after a reboot, + saving it in the metadata so the exact profile is available to all nodes in the cluster , + allowing consistency in testing and laziness in setting up. + + load-profile Loads the status configuration of stats saved under this + profile + save-profile Saves the current configuration of stats and their status in + the metadata under + remove-profile Deletes the entry from the metadata, does not affect the stats + reset-profile Resets all the stats to enabled, "unloads" a profile that is loaded + + + riak_stat Functions : + + Enable the persistence of stats and their configuration, as well as house the profiles + functionality, gives more control over the use and status of all stats within riak + + enable-metadata :: true | false + Enables or disables the metadata in riak_stat, disabling the + metadata will prevent the persistence of stats configuration + + enable-data-persistence + Storing all the information for stats would take up a lot of space, + choosing which stats to persist helps with that + + disable-data-persistence + As above but removing the ability to persist data of a specific + entry or entries + + data-persist-profile + Take the stats that are enabled for a profile and persist only those stats. + + NOTE: Persisting stats requires a lot of memory usage and for a lot of stats can be expensive + in memory and in time. + + Exoskeleskin Functions : + + Set up a socket to push stats to an endpoint via udp or http, + + setup-port similar to stat enable , setting up a port requires + protocol type http | udp, and port number e.g. 8080 + :: udp.8080 for example + Use setup-port to change ports as well as restarting a port + + disable-port can be same as above, closes the socket for that protocol + " } From e6b08d37c86d8759cc87aa9f8dfb0b07199bbfa9 Mon Sep 17 00:00:00 2001 From: banana Date: Tue, 23 Jul 2019 09:32:09 +0100 Subject: [PATCH 04/40] Added stop-persist function to riak-admin stat -- to stop any persisting of data, profile or otherwise --- rel/files/riak-admin | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rel/files/riak-admin b/rel/files/riak-admin index e6465cc3a..d5c184003 100755 --- a/rel/files/riak-admin +++ b/rel/files/riak-admin @@ -116,6 +116,11 @@ stat_admin() node_up_check NODETOOL rpc riak_core_console pro_data_persist "$*" ;; + stop-persist) + shift + node_up_check + NODETOOL rpc riak_core_console stop_persisting "$*" + ;; help) shift case $1 in @@ -208,6 +213,8 @@ Use \`$SCRIPT stat help \` for more details. data-persist-profile Take the stats that are enabled for a profile and persist only those stats. + stop-persist Stop all persistence, of profile or otherwise + NOTE: Persisting stats requires a lot of memory usage and for a lot of stats can be expensive in memory and in time. From 05d8d29e8944b5bd35275f0d2e5a6682578768eb Mon Sep 17 00:00:00 2001 From: banana Date: Mon, 29 Jul 2019 16:12:48 +0100 Subject: [PATCH 05/40] added functions for exoskeleskin abilities --- rel/files/riak-admin | 150 +++++++++++++++++++++++-------------------- 1 file changed, 81 insertions(+), 69 deletions(-) diff --git a/rel/files/riak-admin b/rel/files/riak-admin index d5c184003..10d54cb1e 100755 --- a/rel/files/riak-admin +++ b/rel/files/riak-admin @@ -29,12 +29,7 @@ stat_admin() show) shift node_up_check - NODETOOL rpc riak_core_console stat_enabled "$*" - ;; - show-disabled) - shift - node_up_check - NODETOOL rpc riak_core_console stat_disabled "$*" + NODETOOL rpc riak_core_console stat_show "$*" ;; show-0) shift @@ -91,6 +86,11 @@ stat_admin() node_up_check NODETOOL rpc riak_core_console enable_metadata "$*" ;; + enable-exoskeleskin) + shift + node_up_check + NODETOOL rpc riak_core_console enable_exoskeleskin "$*" + ;; disable-port) shift node_up_check @@ -101,26 +101,6 @@ stat_admin() node_up_check NODETOOL rpc riak_core_console setup_port "$*" ;; - enable-data-persistence) - shift - node_up_check - NODETOOL rpc riak_core_console yes_data_persist "$*" - ;; - disable-data-persistence) - shift - node_up_check - NODETOOL rpc riak_core_console no_data_persist "$*" - ;; - data-persist-profile) - shift - node_up_check - NODETOOL rpc riak_core_console pro_data_persist "$*" - ;; - stop-persist) - shift - node_up_check - NODETOOL rpc riak_core_console stop_persisting "$*" - ;; help) shift case $1 in @@ -136,6 +116,30 @@ stat_admin() info) stat_info_help ;; + load-profile) + stat_profile_help + ;; + save-profile) + stat_profile_help + ;; + remove-profile) + stat_profile_help + ;; + reset-profile) + stat_profile_help + ;; + enable-metadata) + stat_help + ;; + enable-exoskeleskin) + stat_exoskele_help + ;; + disable-port) + stat_exoskele_help + ;; + setup-port) + stat_exoskele_help + ;; *) stat_help esac @@ -165,7 +169,6 @@ Quoting is permitted. Use \`$SCRIPT stat help \` for more details. show Show the value(s) of a specific entry or entries - show-disabled Show the disabled value(s) of a specific entry/entries show-0 Show the stats that are not updating of a specific entry disable-0 Disable the stats that are not updating of an entry enable Enable entry or entries @@ -178,21 +181,6 @@ Use \`$SCRIPT stat help \` for more details. | -options | -ref | -datapoints ] - Profiles : - - Profiles are the specific set up of stats, whether - enabled, disabled or unregistered, it - is recorded in the profile upon saving, loading a profile remains persisted after a reboot, - saving it in the metadata so the exact profile is available to all nodes in the cluster , - allowing consistency in testing and laziness in setting up. - - load-profile Loads the status configuration of stats saved under this - profile - save-profile Saves the current configuration of stats and their status in - the metadata under - remove-profile Deletes the entry from the metadata, does not affect the stats - reset-profile Resets all the stats to enabled, "unloads" a profile that is loaded - - riak_stat Functions : Enable the persistence of stats and their configuration, as well as house the profiles @@ -202,33 +190,6 @@ Use \`$SCRIPT stat help \` for more details. Enables or disables the metadata in riak_stat, disabling the metadata will prevent the persistence of stats configuration - enable-data-persistence - Storing all the information for stats would take up a lot of space, - choosing which stats to persist helps with that - - disable-data-persistence - As above but removing the ability to persist data of a specific - entry or entries - - data-persist-profile - Take the stats that are enabled for a profile and persist only those stats. - - stop-persist Stop all persistence, of profile or otherwise - - NOTE: Persisting stats requires a lot of memory usage and for a lot of stats can be expensive - in memory and in time. - - Exoskeleskin Functions : - - Set up a socket to push stats to an endpoint via udp or http, - - setup-port similar to stat enable , setting up a port requires - protocol type http | udp, and port number e.g. 8080 - :: udp.8080 for example - Use setup-port to change ports as well as restarting a port - - disable-port can be same as above, closes the socket for that protocol - " } @@ -353,6 +314,57 @@ Reset matching stat entries. Only enabled entries can be reset. " } +stat_profile_help() +{ + echo"\ +Usage: $SCRIPT stat + + Profiles are the specific set up of stats, whether - enabled, disabled or unregistered, it + is recorded in the profile upon saving, loading a profile remains persisted after a reboot, + saving it in the metadata so the exact profile is available to all nodes in the cluster, + allowing consistency in testing and laziness in setting up. + + load-profile Loads the status configuration of stats saved under this + profile + + save-profile Saves the current configuration of stats and their status in + the metadata under + + remove-profile Deletes the entry from the metadata, does not affect the stats + + reset-profile Resets all the stats to enabled, "unloads" a profile that is loaded + +" +} + +stat_exoskele_help() +{ + echo"\ + + Exoskeleskin is the stat collector of riak_stat, setup an endpoint with http or udp in order + to poll the stats in exometer and send to endpoint. + Exoskeleskin is enabled by default. + + enable-exoskeleskin [ true | false ] + Enables or disables exoskeleskin + + + setup-port [/opts] similar to stat enable , setting up a port requires + protocol type http | udp, and port number e.g. 8080 + -> protocol=udp port=8080 sip=127.0.0.1 for example + Use setup-port to change ports as well as restarting a port + + opts :: protocol= + port= + instance= + sip + + disable-port can be same as above, closes the socket for that protocol + + " +} + + cluster_admin() { case "$1" in From 30910a5597d295d99d01d403c76fa091f2416c93 Mon Sep 17 00:00:00 2001 From: banana Date: Thu, 1 Aug 2019 11:20:53 +0100 Subject: [PATCH 06/40] updated the functions for setting up an endpoint and setting down the endpoint, and a function to request data from exometer via http. similar functionality to riak_stat:stat_show, but can include the app_stats and expanded_disk stats, updated exoskele_help() in riak-admin as well --- rel/files/riak-admin | 49 +++++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/rel/files/riak-admin b/rel/files/riak-admin index 10d54cb1e..cd4ac9da5 100755 --- a/rel/files/riak-admin +++ b/rel/files/riak-admin @@ -91,16 +91,22 @@ stat_admin() node_up_check NODETOOL rpc riak_core_console enable_exoskeleskin "$*" ;; - disable-port) + setdown-endpoint) shift node_up_check - NODETOOL rpc riak_core_console disable_port "$*" + NODETOOL rpc riak_core_console setdown_endpoint "$*" ;; - setup-port) + setup-endpoint) shift node_up_check - NODETOOL rpc riak_core_console setup_port "$*" + NODETOOL rpc riak_core_console setup_endpoint "$*" ;; + collect) + shift + node_up_check + NODETOOL rpc riak_core_console wm_collect "$*" + ;; + help) shift case $1 in @@ -134,10 +140,13 @@ stat_admin() enable-exoskeleskin) stat_exoskele_help ;; - disable-port) + setdown-endpoint) stat_exoskele_help ;; - setup-port) + setup-endpoint) + stat_exoskele_help + ;; + collect) stat_exoskele_help ;; *) @@ -345,21 +354,33 @@ stat_exoskele_help() to poll the stats in exometer and send to endpoint. Exoskeleskin is enabled by default. - enable-exoskeleskin [ true | false ] + enable-exoskeleskin [ true | false ] Enables or disables exoskeleskin - setup-port [/opts] similar to stat enable , setting up a port requires - protocol type http | udp, and port number e.g. 8080 - -> protocol=udp port=8080 sip=127.0.0.1 for example - Use setup-port to change ports as well as restarting a port + collect Uses webmachine to obtain stats from exometer, works in a + similar way to stat show, i.e. + riak-admin stat collect riak.riak_kv.*.gets + will return all the stats in riak_kv involving gets in that pad, + And in such a way that: + riak-admin stat collect app-stats, disk-stats + are specific aliases to fetch the stats for the app and the stats + from the disk usages. can also be 'all' to retrieve + everything. + + :: all | app-stats, disk-stats, + + setup-endpoint [opts] similar to stat enable , setting up a port requires + the port number e.g. 8080, otherwise it can be pulled out of + config. + -> protocol=udp port=8080 sip=127.0.0.1 for example + Use setup-port to change ports as well as restarting a port - opts :: protocol= - port= + opts :: port= instance= sip - disable-port can be same as above, closes the socket for that protocol + setdown-endpoint can be same as above, closes the socket for that protocol " } From b9c97af20d54b353ccbf6a13783537a307d92c55 Mon Sep 17 00:00:00 2001 From: banana Date: Fri, 2 Aug 2019 08:16:17 +0100 Subject: [PATCH 07/40] removed 'collect' function --- rel/files/riak-admin | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/rel/files/riak-admin b/rel/files/riak-admin index cd4ac9da5..f3990986f 100755 --- a/rel/files/riak-admin +++ b/rel/files/riak-admin @@ -357,19 +357,6 @@ stat_exoskele_help() enable-exoskeleskin [ true | false ] Enables or disables exoskeleskin - - collect Uses webmachine to obtain stats from exometer, works in a - similar way to stat show, i.e. - riak-admin stat collect riak.riak_kv.*.gets - will return all the stats in riak_kv involving gets in that pad, - And in such a way that: - riak-admin stat collect app-stats, disk-stats - are specific aliases to fetch the stats for the app and the stats - from the disk usages. can also be 'all' to retrieve - everything. - - :: all | app-stats, disk-stats, - setup-endpoint [opts] similar to stat enable , setting up a port requires the port number e.g. 8080, otherwise it can be pulled out of config. From 868d3ff96704d4dee8b0ef667a14c07b47953f32 Mon Sep 17 00:00:00 2001 From: banana Date: Mon, 5 Aug 2019 10:41:57 +0100 Subject: [PATCH 08/40] rebar changes --- rebar.config | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rebar.config b/rebar.config index c1f067c19..8f7d19d51 100644 --- a/rebar.config +++ b/rebar.config @@ -13,11 +13,11 @@ {deps, [ {lager_syslog, {git, "git://github.com/basho/lager_syslog.git", {branch, "develop-3.0"}}}, {cluster_info, {git, "git://github.com/basho/cluster_info.git", {branch, "develop-3.0"}}}, - {riak_kv, {git, "git://github.com/basho/riak_kv.git", {branch, "develop-3.0"}}}, + {riak_kv, {git, "git://github.com/basho/riak_kv.git", {branch, "develop-3.0-riak_stat"}}}, {riak_auth_mods, {git, "git://github.com/basho/riak_auth_mods.git", {branch, "develop-3.0"}}}, - {riak_repl, {git, "git://github.com/basho/riak_repl.git", {branch, "develop-3.0"}}}, - {yokozuna, {git, "git://github.com/basho/yokozuna.git", {branch, "develop-3.0"}}}, - {riak_stat, {git, "https://github.com/bet365/riak_stat.git", {branch, "develop-2.2.8-stats-work"}}} + {riak_repl, {git, "git://github.com/basho/riak_repl.git", {branch, "develop-3.0-riak_stat"}}}, + {yokozuna, {git, "git://github.com/basho/yokozuna.git", {branch, "develop-3.0-stats-work"}}}, + {riak_stat, {git, "https://github.com/bet365/riak_stat.git", {branch, "develop-3.0-stats-work"}}} ]}. {project_plugins, [ From 938bb1db3dd4105d8ff7fb201c3f1bb09573c41b Mon Sep 17 00:00:00 2001 From: banana Date: Tue, 6 Aug 2019 08:50:12 +0100 Subject: [PATCH 09/40] Changed to relx_nodetool --- rel/files/riak-admin | 48 +++++++++++++++----------------------------- 1 file changed, 16 insertions(+), 32 deletions(-) diff --git a/rel/files/riak-admin b/rel/files/riak-admin index f3990986f..99c38bffd 100755 --- a/rel/files/riak-admin +++ b/rel/files/riak-admin @@ -28,83 +28,67 @@ stat_admin() case "$1" in show) shift - node_up_check - NODETOOL rpc riak_core_console stat_show "$*" + relx_nodetool rpc riak_core_console stat_show "$*" ;; show-0) shift - node_up_check - NODETOOL rpc riak_core_console stat_0 "$*" + relx_nodetool rpc riak_core_console stat_0 "$*" ;; disable-0) shift - node_up_check - NODETOOL rpc riak_core_console stat_disable_0 "$*" + relx_nodetool rpc riak_core_console stat_disable_0 "$*" ;; info) shift - node_up_check - NODETOOL rpc riak_core_console stat_info "$*" + relx_nodetool rpc riak_core_console stat_info "$*" ;; enable) shift - node_up_check - NODETOOL rpc riak_core_console stat_enable "$*" + relx_nodetool rpc riak_core_console stat_enable "$*" ;; disable) shift - node_up_check - NODETOOL rpc riak_core_console stat_disable "$*" + relx_nodetool rpc riak_core_console stat_disable "$*" ;; reset) shift - node_up_check - NODETOOL rpc riak_core_console stat_reset "$*" + nrelx_nodetool rpc riak_core_console stat_reset "$*" ;; load-profile) shift - node_up_check - NODETOOL rpc riak_core_console load_profile "$*" + relx_nodetool rpc riak_core_console load_profile "$*" ;; save-profile) shift - node_up_check - NODETOOL rpc riak_core_console add_profile "$*" + relx_nodetool rpc riak_core_console add_profile "$*" ;; remove-profile) shift - node_up_check - NODETOOL rpc riak_core_console remove_profile "$*" + relx_nodetool rpc riak_core_console remove_profile "$*" ;; reset-profile) shift - node_up_check - NODETOOL rpc riak_core_console reset_profile "$*" + relx_nodetool rpc riak_core_console reset_profile "$*" ;; enable-metadata) shift - node_up_check - NODETOOL rpc riak_core_console enable_metadata "$*" + relx_nodetool rpc riak_core_console enable_metadata "$*" ;; enable-exoskeleskin) shift - node_up_check - NODETOOL rpc riak_core_console enable_exoskeleskin "$*" + relx_nodetool rpc riak_core_console enable_exoskeleskin "$*" ;; setdown-endpoint) shift - node_up_check - NODETOOL rpc riak_core_console setdown_endpoint "$*" + relx_nodetool rpc riak_core_console setdown_endpoint "$*" ;; setup-endpoint) shift - node_up_check - NODETOOL rpc riak_core_console setup_endpoint "$*" + relx_nodetool rpc riak_core_console setup_endpoint "$*" ;; collect) shift - node_up_check - NODETOOL rpc riak_core_console wm_collect "$*" + relx_nodetool rpc riak_core_console wm_collect "$*" ;; help) From 888d14a62970e2b2904f36b95b0c11b77b5f43ba Mon Sep 17 00:00:00 2001 From: banana Date: Tue, 6 Aug 2019 12:48:08 +0100 Subject: [PATCH 10/40] change app.src --- apps/riak/src/riak.app.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/riak/src/riak.app.src b/apps/riak/src/riak.app.src index 650f8b385..30b7016bd 100644 --- a/apps/riak/src/riak.app.src +++ b/apps/riak/src/riak.app.src @@ -7,13 +7,13 @@ kernel, stdlib, lager, + riak_stat, sasl, public_key, ssl, os_mon, crypto, riak, - riak_stat, cuttlefish, runtime_tools, lager_syslog, From fe2ee42145d69665fcc130250a402585280a0ab1 Mon Sep 17 00:00:00 2001 From: banana Date: Thu, 22 Aug 2019 10:04:46 +0100 Subject: [PATCH 11/40] updated stat_ep_help() for more information on endpoints for udp. removed unused functions, updated help for profiles and other stat functions --- rel/files/riak-admin | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/rel/files/riak-admin b/rel/files/riak-admin index 99c38bffd..6ad917e4a 100755 --- a/rel/files/riak-admin +++ b/rel/files/riak-admin @@ -74,10 +74,6 @@ stat_admin() shift relx_nodetool rpc riak_core_console enable_metadata "$*" ;; - enable-exoskeleskin) - shift - relx_nodetool rpc riak_core_console enable_exoskeleskin "$*" - ;; setdown-endpoint) shift relx_nodetool rpc riak_core_console setdown_endpoint "$*" @@ -86,11 +82,6 @@ stat_admin() shift relx_nodetool rpc riak_core_console setup_endpoint "$*" ;; - collect) - shift - relx_nodetool rpc riak_core_console wm_collect "$*" - ;; - help) shift case $1 in @@ -121,17 +112,11 @@ stat_admin() enable-metadata) stat_help ;; - enable-exoskeleskin) - stat_exoskele_help - ;; setdown-endpoint) - stat_exoskele_help + stat_ep_help ;; setup-endpoint) - stat_exoskele_help - ;; - collect) - stat_exoskele_help + stat_ep_help ;; *) stat_help @@ -330,16 +315,12 @@ Usage: $SCRIPT stat " } -stat_exoskele_help() +stat_ep_help() { echo"\ - Exoskeleskin is the stat collector of riak_stat, setup an endpoint with http or udp in order + Endpoint is the stat collector of riak_stat, setup an endpoint with udp in order to poll the stats in exometer and send to endpoint. - Exoskeleskin is enabled by default. - - enable-exoskeleskin [ true | false ] - Enables or disables exoskeleskin setup-endpoint [opts] similar to stat enable , setting up a port requires the port number e.g. 8080, otherwise it can be pulled out of From 25a8eacf2940e00e4c708d76f671b5325ecb24b6 Mon Sep 17 00:00:00 2001 From: banana Date: Wed, 28 Aug 2019 17:40:49 +0100 Subject: [PATCH 12/40] fixed error for stat_profile_help(), changed the riak admin stat save-profile etc to riak admin profile save, loiad, delete reset etc... to make it more simple and easier to understand --- rel/files/riak-admin | 103 ++++++++++++++++++++++++++----------------- 1 file changed, 62 insertions(+), 41 deletions(-) diff --git a/rel/files/riak-admin b/rel/files/riak-admin index 6ad917e4a..8109d28e6 100755 --- a/rel/files/riak-admin +++ b/rel/files/riak-admin @@ -16,13 +16,57 @@ usage() { echo " reip | js-reload | erl-reload | wait-for-service | " echo " ringready | transfers | force-remove | down |" echo " cluster-info | member-status | ring-status | vnode-status |" - echo " aae-status | diag | stat | status | transfer-limit | reformat-indexes |" + echo " aae-status | diag | stat | profile | status | transfer-limit | reformat-indexes |" echo " top [-interval N] [-sort reductions|memory|msg_q] [-lines N] |" echo " downgrade-objects | security | bucket-type | repair-2i |" echo " search | services | ensemble-status | handoff | set |" echo " show | describe }" } +profile_admin() +{ + case "$1" in + load) + shift + relx_nodetool rpc riak_core_console load_profile "$*" + ;; + save) + shift + relx_nodetool rpc riak_core_console add_profile "$*" + ;; + delete) + shift + relx_nodetool rpc riak_core_console remove_profile "$*" + ;; + reset) + shift + relx_nodetool rpc riak_core_console reset_profile "$*" + ;; + help) + shift + case "$1" in + load) + stat_profile_help + ;; + save) + stat_profile_help + ;; + remove) + stat_profile_help + ;; + reset) + stat_profile_help + ;; + *) + stat_profile_help + esac + ;; + *) + stat_profile_help + esac +} + + stat_admin() { case "$1" in @@ -54,22 +98,6 @@ stat_admin() shift nrelx_nodetool rpc riak_core_console stat_reset "$*" ;; - load-profile) - shift - relx_nodetool rpc riak_core_console load_profile "$*" - ;; - save-profile) - shift - relx_nodetool rpc riak_core_console add_profile "$*" - ;; - remove-profile) - shift - relx_nodetool rpc riak_core_console remove_profile "$*" - ;; - reset-profile) - shift - relx_nodetool rpc riak_core_console reset_profile "$*" - ;; enable-metadata) shift relx_nodetool rpc riak_core_console enable_metadata "$*" @@ -97,18 +125,6 @@ stat_admin() info) stat_info_help ;; - load-profile) - stat_profile_help - ;; - save-profile) - stat_profile_help - ;; - remove-profile) - stat_profile_help - ;; - reset-profile) - stat_profile_help - ;; enable-metadata) stat_help ;; @@ -294,23 +310,24 @@ Reset matching stat entries. Only enabled entries can be reset. stat_profile_help() { - echo"\ -Usage: $SCRIPT stat + echo "\ +Usage: $SCRIPT profile - Profiles are the specific set up of stats, whether - enabled, disabled or unregistered, it - is recorded in the profile upon saving, loading a profile remains persisted after a reboot, - saving it in the metadata so the exact profile is available to all nodes in the cluster, - allowing consistency in testing and laziness in setting up. +Profiles are the specific set up of stats, whether - enabled, +disabled or unregistered, it is recorded in the profile upon saving, +loading a profile remains persisted after a reboot, saving it in +the metadata so the exact profile is available to all nodes in the cluster, +allowing consistency in testing and laziness in setting up. - load-profile Loads the status configuration of stats saved under this - profile + load Loads the status configuration of stats saved under this + profile - save-profile Saves the current configuration of stats and their status in - the metadata under + save Saves the current configuration of stats and their status in + the metadata under - remove-profile Deletes the entry from the metadata, does not affect the stats + delete Deletes the entry from the metadata, does not affect the stats - reset-profile Resets all the stats to enabled, "unloads" a profile that is loaded + reset Resets all the stats to enabled, unloads a profile that is loaded " } @@ -1125,6 +1142,10 @@ case "$1" in shift stat_admin "$@" ;; + profile) + shift + profile_admin "$@" + ;; bucket-type) shift btype_admin "$@" From 2ccb0d9a4355b314517e895ad68187069bb5dcf2 Mon Sep 17 00:00:00 2001 From: banana Date: Mon, 16 Sep 2019 17:07:56 +0100 Subject: [PATCH 13/40] fixed untested functions error on line:99 as there was a typo for relx_nodetool --- rel/files/riak-admin | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rel/files/riak-admin b/rel/files/riak-admin index 8109d28e6..71ec21dca 100755 --- a/rel/files/riak-admin +++ b/rel/files/riak-admin @@ -96,7 +96,7 @@ stat_admin() ;; reset) shift - nrelx_nodetool rpc riak_core_console stat_reset "$*" + relx_nodetool rpc riak_core_console stat_reset "$*" ;; enable-metadata) shift @@ -163,8 +163,8 @@ Quoting is permitted. Use \`$SCRIPT stat help \` for more details. show Show the value(s) of a specific entry or entries - show-0 Show the stats that are not updating of a specific entry - disable-0 Disable the stats that are not updating of an entry + show-0 Show the entry or entries that are not updating + disable-0 Disable the entry or entries that are not updating enable Enable entry or entries disable Disable entry or entries reset Reset entry or entries From bd4f66154638e4cf3fc297c90d1a2aedf5d1b272 Mon Sep 17 00:00:00 2001 From: banana Date: Wed, 25 Sep 2019 10:53:48 +0100 Subject: [PATCH 14/40] added new function find-info into the bash script, this can be used to find information on the polling requests based on their port, instance, protocol, serverip etc.. works using riak_core_metadata:fold(...) to iterate over the protocol given, otherwise over everthing in that prefix --- rel/files/riak-admin | 49 +++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/rel/files/riak-admin b/rel/files/riak-admin index 71ec21dca..9e58dddc2 100755 --- a/rel/files/riak-admin +++ b/rel/files/riak-admin @@ -14,7 +14,7 @@ SCRIPT=`basename $0` usage() { echo "Usage: $SCRIPT { cluster | join | leave | backup | restore | test | " echo " reip | js-reload | erl-reload | wait-for-service | " - echo " ringready | transfers | force-remove | down |" + echo " ringready | transfers | force-remove | down | push |" echo " cluster-info | member-status | ring-status | vnode-status |" echo " aae-status | diag | stat | profile | status | transfer-limit | reformat-indexes |" echo " top [-interval N] [-sort reductions|memory|msg_q] [-lines N] |" @@ -102,14 +102,6 @@ stat_admin() shift relx_nodetool rpc riak_core_console enable_metadata "$*" ;; - setdown-endpoint) - shift - relx_nodetool rpc riak_core_console setdown_endpoint "$*" - ;; - setup-endpoint) - shift - relx_nodetool rpc riak_core_console setup_endpoint "$*" - ;; help) shift case $1 in @@ -128,12 +120,6 @@ stat_admin() enable-metadata) stat_help ;; - setdown-endpoint) - stat_ep_help - ;; - setup-endpoint) - stat_ep_help - ;; *) stat_help esac @@ -143,6 +129,26 @@ stat_admin() esac } +push_admin() +{ + case "$1" in + setup) + shift + relx_nodetool rpc riak_core_console setup_endpoint "$*" + ;; + setdown) + shift + relx_nodetool rpc riak_core_console setdown_endpoint "$*" + ;; + find-info) + shift + relx_nodetool rpc riak_core_console find_push_stats "$*" + ;; + *) + push_help + esac +} + stat_help() { @@ -332,7 +338,7 @@ allowing consistency in testing and laziness in setting up. " } -stat_ep_help() +push_help() { echo"\ @@ -345,12 +351,17 @@ stat_ep_help() -> protocol=udp port=8080 sip=127.0.0.1 for example Use setup-port to change ports as well as restarting a port - opts :: port= + opts :: protocol= udp | tcp + port= instance= sip setdown-endpoint can be same as above, closes the socket for that protocol + find-info can also be the same as above, works in a similar + way to riak stat show, to find the information based + on protocol, instance or whether it is still running etc. + " } @@ -1146,6 +1157,10 @@ case "$1" in shift profile_admin "$@" ;; + push) + shift + push_admin "$@" + ;; bucket-type) shift btype_admin "$@" From 5876ba8d041435a5a5660e7f44966e1625feb31c Mon Sep 17 00:00:00 2001 From: banana Date: Fri, 4 Oct 2019 16:29:44 +0100 Subject: [PATCH 15/40] moved push_help() --- rel/files/riak-admin | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/rel/files/riak-admin b/rel/files/riak-admin index 9e58dddc2..8f0eb03a7 100755 --- a/rel/files/riak-admin +++ b/rel/files/riak-admin @@ -345,18 +345,19 @@ push_help() Endpoint is the stat collector of riak_stat, setup an endpoint with udp in order to poll the stats in exometer and send to endpoint. - setup-endpoint [opts] similar to stat enable , setting up a port requires - the port number e.g. 8080, otherwise it can be pulled out of - config. - -> protocol=udp port=8080 sip=127.0.0.1 for example - Use setup-port to change ports as well as restarting a port + setup [opts] similar to stat enable , setting up requires + the port number e.g. 8080, serverip == sip, and protocol + -> protocol=udp,port=8080,sip=127.0.0.1 for example + Use setup-port to change ports as well as restarting a port, + Specific stats can be chosen to be pushed, otherwise the + default will poll all stats in exometer. opts :: protocol= udp | tcp port= instance= sip - setdown-endpoint can be same as above, closes the socket for that protocol + setdown can be same as above, closes the socket for that protocol find-info can also be the same as above, works in a similar way to riak stat show, to find the information based From 9070cbb5b10038acedcf2b4e6991d688a77e1abb Mon Sep 17 00:00:00 2001 From: ragecherrypanda Date: Mon, 7 Oct 2019 15:01:42 +0100 Subject: [PATCH 16/40] Added a test command in the rel/files/riak-admin to test the pushing of stats in a local gen_server --- rel/files/riak-admin | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rel/files/riak-admin b/rel/files/riak-admin index 8f0eb03a7..0ad726e32 100755 --- a/rel/files/riak-admin +++ b/rel/files/riak-admin @@ -144,6 +144,10 @@ push_admin() shift relx_nodetool rpc riak_core_console find_push_stats "$*" ;; + test) + shift + relx_nodetool rpc riak_core_console test_push_stats "$*" + ;; *) push_help esac From a5b71fe321b29a3040a83d2c7596fa3eaaa6f893 Mon Sep 17 00:00:00 2001 From: banana Date: Tue, 29 Oct 2019 15:37:12 +0000 Subject: [PATCH 17/40] Created help functions for: stat show-0, stat disable-0, stat metadata. push setup, push setdown, push info. profile save, profile load, profile delete, profile reset. Changed the riak admin push find-info -> riak admin push info. Changed functionality of riak admin stat enable-metadata true|false -> riak admin stat metadata enable|disable changed /bin/riak-admin in examples -> riak admin... Added indents on all the echo help functions to better distinguish them from the command line. also adding padding above and below them. --- rel/files/riak-admin | 578 ++++++++++++++++++++++++++++++------------- 1 file changed, 405 insertions(+), 173 deletions(-) diff --git a/rel/files/riak-admin b/rel/files/riak-admin index 0ad726e32..e129c1bf2 100755 --- a/rel/files/riak-admin +++ b/rel/files/riak-admin @@ -46,23 +46,23 @@ profile_admin() shift case "$1" in load) - stat_profile_help + profile_load_help ;; save) - stat_profile_help + profile_save_help ;; - remove) - stat_profile_help + delete) + profile_delete_help ;; reset) - stat_profile_help + profile_reset_help ;; *) - stat_profile_help + profile_help esac ;; *) - stat_profile_help + profile_help esac } @@ -98,9 +98,9 @@ stat_admin() shift relx_nodetool rpc riak_core_console stat_reset "$*" ;; - enable-metadata) + metadata) shift - relx_nodetool rpc riak_core_console enable_metadata "$*" + relx_nodetool rpc riak_core_console stat_metadata "$*" ;; help) shift @@ -108,17 +108,26 @@ stat_admin() show) stat_show_help ;; + show-0) + stat_show_0_help + ;; enable) stat_enable_help ;; disable) stat_enable_help ;; + disable-0) + stat_disable_0_help + ;; info) stat_info_help ;; - enable-metadata) - stat_help + reset) + stat_reset_help + ;; + metadata) + stat_metadata_help ;; *) stat_help @@ -140,16 +149,29 @@ push_admin() shift relx_nodetool rpc riak_core_console setdown_endpoint "$*" ;; - find-info) + info) shift relx_nodetool rpc riak_core_console find_push_stats "$*" ;; - test) + help) shift - relx_nodetool rpc riak_core_console test_push_stats "$*" + case "$1" in + setup) + push_setup_help + ;; + setdown) + push_setdown_help + ;; + info) + push_info_help + ;; + *) + push_help + ;; + esac ;; *) - push_help + push_help esac } @@ -157,42 +179,43 @@ push_admin() stat_help() { echo "\ -Usage: $SCRIPT stat - -The following commands display, enable/disable and reset statistics. -A statistics entry is given either as a 'dotted' exometer name - -Identifiers separated by periods, '.', e.g. riak.riak_kv.node.gets, -or as a 'legacy' name (same as in riak-admin status) - e.g. node_gets. -When a legacy name is listed, the corresponding exometer name is shown as well. - -Two kinds of wildcard are suppored: -* - matches anything up to the next separator ('.' or '_') or end of name; -** - matches anything including separators. -Quoting is permitted. - -Use \`$SCRIPT stat help \` for more details. - - show Show the value(s) of a specific entry or entries - show-0 Show the entry or entries that are not updating - disable-0 Disable the entry or entries that are not updating - enable Enable entry or entries - disable Disable entry or entries - reset Reset entry or entries - info [ -name | -type | Display information about the entry or entries. - | -module The attributes are described in the Exometer docs - | -value | -cache - | -status | -timestamp - | -options | -ref - | -datapoints ] - - riak_stat Functions : - - Enable the persistence of stats and their configuration, as well as house the profiles - functionality, gives more control over the use and status of all stats within riak - - enable-metadata :: true | false - Enables or disables the metadata in riak_stat, disabling the - metadata will prevent the persistence of stats configuration + + Usage: $SCRIPT stat + + The following commands display, enable/disable and reset statistics. + A statistics entry is given either as a 'dotted' exometer name - + Identifiers separated by periods, '.', e.g. riak.riak_kv.node.gets, + or as a 'legacy' name (same as in riak-admin status) - e.g. node_gets. + When a legacy name is listed, the corresponding exometer name is shown as well. + + Two kinds of wildcard are suppored: + * - matches anything up to the next separator ('.' or '_') or end of name; + ** - matches anything including separators. + Quoting is permitted. + + Use \`$SCRIPT stat help \` for more details. + + show Show the value(s) of a specific entry or entries + show-0 Show the entry or entries that are not updating + disable-0 Disable the entry or entries that are not updating + enable Enable entry or entries + disable Disable entry or entries + reset Reset entry or entries + info [ -name | -type | Display information about the entry or entries. + | -module The attributes are described in the Exometer docs + | -value | -cache + | -status | -timestamp + | -options | -ref + | -datapoints ] + + riak_stat Functions : + + Enable the persistence of stats and their configuration, as well as house the profiles + functionality, gives more control over the use and status of all stats within riak + + metadata :: enable | disable + Enables or disables the metadata in riak_stat, disabling the + metadata will prevent the persistence of stats configuration " } @@ -200,172 +223,381 @@ Use \`$SCRIPT stat help \` for more details. stat_show_help() { echo "\ -Usage: $SCRIPT stat show [/type=][/status=][/[,]] - -Show matching stats entries together with corresponding values - -The format of can be one of: -- 'Dotted exometer name': In Exometer, entries are represented as [A,B,...]. -These names can be emulated on the command-line as A.B.... Wildcards are -supported: '*' will match anything between deliminators (dots), whereas -'**' will match anything including deliminators. Thus \`stat show \"*.**\"\` -will match all stats entries. All Riak stat entry names start with 'riak', -so \`stat show riak.**\` will match all riak stat entries. - -Example: -\$ bin/riak-admin stat show riak.riak_kv.node.gets -[riak,riak_kv,node,gets]: [{count,0},{one,0}] - -- 'Legacy name': The stat names used e.g. in \`$SCRIPT status\` can be used -here, but also with wildcard support. The corresponding Exometer name and -datapoint will be shown as well. - -Example: -\$ bin/riak-admin stat show node_gets -== node_gets (Legacy pattern): == -node_gets: 0 ([riak,riak_kv,node,gets]/one) - -(Note: A single '*' is treated as a legacy name and would match all such -names that contain no underscores; to match all exometer names, a '.' must -be present, so '*.**' would work as a catch-all expression.) - -Each Exometer entry has a type and a set of datapoints. A filter can be -given on the command line, selecting only a subset of datapoints: - -\$ bin/riak-admin stat show riak.riak_kv.node.gets/one -[riak,riak_kv,node,gets]: [{one,0}] - -The type can also be restricted: -\$ bin/riak-admin stat show *.**/type=duration/mean,max -[riak,riak_core,converge_delay]: [{mean,0},{max,0}] -[riak,riak_core,rebalance_delay]: [{mean,0},{max,0}] - -Note how multiple datapoints are separated by comma (no space). - -Showing disabled entries: -\$ bin/riak-admin stat show riak.riak_kv.node.gets -No matching stats -\$ bin/riak-admin stat show riak.riak_kv.node.gets/status=* -[riak,riak_kv,node,gets]: disabled -\$ bin/riak-admin stat show riak.riak_kv.node.gets/status=disabled -[riak,riak_kv,node,gets]: disabled + + Usage: $SCRIPT admin stat show [/type=][/status=][/[,]] + + Show matching stats entries together with corresponding values + + The format of can be one of: + - 'Dotted exometer name': In Exometer, entries are represented as [A,B,...]. + These names can be emulated on the command-line as A.B.... Wildcards are + supported: '*' will match anything between deliminators (dots), whereas + '**' will match anything including deliminators. Thus \`stat show \"*.**\"\` + will match all stats entries. All Riak stat entry names start with 'riak', + so \`stat show riak.**\` will match all riak stat entries. + + Example: + \$ riak admin stat show riak.riak_kv.node.gets + [riak,riak_kv,node,gets]: [{count,0},{one,0}] + + - 'Legacy name': The stat names used e.g. in \`$SCRIPT status\` can be used + here, but also with wildcard support. The corresponding Exometer name and + datapoint will be shown as well. + + Example: + \$ riak admin stat show node_gets + == node_gets (Legacy pattern): == + node_gets: 0 ([riak,riak_kv,node,gets]/one) + + (Note: A single '*' is treated as a legacy name and would match all such + names that contain no underscores; to match all exometer names, a '.' must + be present, so '*.**' would work as a catch-all expression.) + + Each Exometer entry has a type and a set of datapoints. A filter can be + given on the command line, selecting only a subset of datapoints: + + \$ riak admin stat show riak.riak_kv.node.gets/one + [riak,riak_kv,node,gets]: [{one,0}] + + The type can also be restricted: + \$ riak admin stat show *.**/type=duration/mean,max + [riak,riak_core,converge_delay]: [{mean,0},{max,0}] + [riak,riak_core,rebalance_delay]: [{mean,0},{max,0}] + + Note how multiple datapoints are separated by comma (no space). + + Showing disabled entries: + \$ riak admin stat show riak.riak_kv.node.gets + No matching stats + \$ riak admin stat show riak.riak_kv.node.gets/status=* + [riak,riak_kv,node,gets]: disabled + \$ riak admin stat show riak.riak_kv.node.gets/status=disabled + [riak,riak_kv,node,gets]: disabled " } +stat_show_0_help() +{ + echo "\ + + Usage: $SCRIPT admin stat show-0 [/type=][/status=] + + Shows the Stats in riak, that are not updating or have a value of 0. + + See 'riak admin stat help show for the formatting of the , + this works in the same way. + + Example: + + \$ riak admin stat show-0 riak.**/type=duration + [riak,riak_core,converge_delay]: [{mean,0},{max,0}] + [riak,riak_core,rebalance_delay]: [{mean,0},{max,0}] + + " +} + stat_enable_help() { echo "\ -Exometer stats can be disabled and enabled, and this can be done from $SCRIPT -using \`$SCRIPT enable|disable \`. Disabled entries are not actively -updated, and have no value. -The same syntax can be used as in \`stat show\`. The requested action will be -performed on the matching entries. + Exometer stats can be disabled and enabled, and this can be done + using \`$SCRIPT admin stat enable|disable \`. Disabled entries are not actively + updated, and have no value. -\$ bin/riak-admin stat disable node_gets -== node_gets (Legacy pattern): == -[riak,riak_kv,node,gets]: disabled -\$ bin/riak-admin stat enable node_gets -== node_gets (Legacy pattern): == -[riak,riak_kv,node,gets]: enabled + The same syntax can be used as in \`stat show\`. The requested action will be + performed on the matching entries. -Wildcards can be used: + \$ riak admin stat disable node_gets + == node_gets (Legacy pattern): == + [riak,riak_kv,node,gets]: disabled + \$ riak admin stat enable node_gets + == node_gets (Legacy pattern): == + [riak,riak_kv,node,gets]: enabled -\$ bin/riak-admin stat disable riak.riak_kv.node.* -[riak,riak_kv,node,gets]: disabled -[riak,riak_kv,node,puts]: disabled + Wildcards can be used: + + \$ riak admin stat disable riak.riak_kv.node.* + [riak,riak_kv,node,gets]: disabled + [riak,riak_kv,node,puts]: disabled " } +stat_disable_0_help() +{ + echo "\ + + Some stats in exometer might go unused, and will not update often if + at all. \`$SCRIPT admin stat disable-0\` disables all the stats in exometer + that are enabled and have not updated at all. + + The same syntax can be used as in \`stat show\`. The requested action will be + performed on the matching entries, in the same way as \`stat disable\`. + + \$ riak admin stat disable-0 node_gets + == node_gets (Legacy pattern): == + [riak,riak_kv,node,gets]: disabled + + Wildcards can be used: + + \$ riak admin stat disable-0 riak.riak_kv.node.* + [riak,riak_kv,node,gets]: disabled + [riak,riak_kv,node,puts]: disabled +" +} + + stat_info_help() { echo "\ -Display Exometer meta-data for matching entries. Type of data can be controlled -with options: - - info [ -name | -type - | -module - | -value | -cache - | -status | -timestamp - | -options | -ref - | -datapoints ] - -The same entry formats can be used as for all other stat subcommands. - -Example: -\$ bin/riak-admin stat info riak.riak_kv.node.gets -[riak,riak_kv,node,gets]: name = [riak,riak_kv,node,gets] - type = spiral - module = exometer_spiral - value = disabled - cache = 0 - status = disabled - timestamp = undefined - options = [{status,disabled}] - -\$ bin/riak-admin stat info -type -status riak.riak_kv.node.gets -[riak,riak_kv,node,gets]: type = spiral - status = disabled + + Usage: $SCRIPT admin stat info [- [-]] + + Display Exometer meta-data for matching entries. Type of data can be controlled + with options: + + info [ -name | -type + | -module + | -value | -cache + | -status | -timestamp + | -options | -ref + | -datapoints ] + + The same entry formats can be used as for all other stat subcommands. + + Example: + \$ riak admin stat info riak.riak_kv.node.gets + [riak,riak_kv,node,gets]: name = [riak,riak_kv,node,gets] + type = spiral + module = exometer_spiral + value = disabled + cache = 0 + status = disabled + timestamp = undefined + options = [{status,disabled}] + + \$ riak admin stat info -type -status riak.riak_kv.node.gets + [riak,riak_kv,node,gets]: type = spiral + status = disabled " } stat_reset_help() { echo "\ -Usage: $SCRIPT stat reset -Reset matching stat entries. Only enabled entries can be reset. + Usage: $SCRIPT admin stat reset + + Reset matching stat entries. Only enabled entries can be reset. +" +} + +stat_metadata_help() +{ + echo "\ + + Usage $SCRIPT admin stat metadata =enable|disable + + Enable or Disable the persistence of stat options and configuration in + the metadata. Disabling would mean the status of the stat, i.e. whether + it is enabled or disabled would not be persisted as well, so on reboot the + stat will be enabled as default. + +" +} + +profile_help() +{ + echo "\ + + Usage: $SCRIPT admin profile [] + + Profiles are the specific set up of stats, whether - enabled, + disabled or unregistered, it is recorded in the profile upon saving, + loading a profile remains persisted after a reboot, saving it in + the metadata so the exact profile is available to all nodes in the cluster, + allowing consistency in testing and laziness in setting up. + + load Loads the status configuration of stats saved under this + profile + + save Saves the current configuration of stats and their status in + the metadata under + + delete Deletes the entry from the metadata, does not affect the stats + + reset Resets all the stats to enabled, unloads a profile that is loaded + +" +} + +profile_load_help() +{ + echo "\ + + Usage: $SCRIPT admin profile load + + Load all the stats in a \`profile\` that have a different status to the + one in exometer, and record \`profile\` as ''loaded'' in the metadata. upon reboot + the profile that was loaded on the node last will be ''reloaded''. + + Will load profile that has been saved on a different node, as it is gossiped round + to the rest of the cluster. + +" +} + +profile_save_help() +{ + echo "\ + + Usage: $SCRIPT admin profile save + + Takes the string given as the profile's name, saves the currnet configuration of + stats, i.e. their status - being enabled or disabled, their type and how many times + they have been reset (This option is also recorded in exometer but it is not persisted) + + If the profile name entered is the same as another profile in the metadata it will + be overwritten. - Best to load the profile first top check. If that profile name does + not exist, you're in the clear. + " } -stat_profile_help() +profile_delete_help() { echo "\ -Usage: $SCRIPT profile -Profiles are the specific set up of stats, whether - enabled, -disabled or unregistered, it is recorded in the profile upon saving, -loading a profile remains persisted after a reboot, saving it in -the metadata so the exact profile is available to all nodes in the cluster, -allowing consistency in testing and laziness in setting up. + Usage: $SCRIPT admin profile delete - load Loads the status configuration of stats saved under this - profile + Deletes the Profile from the metadata for all nodes in the cluster. If the profile is + loaded on another node it will not effect it. If it is loaded on this node it will ''unload'' + it but not change any configuration of stats. - save Saves the current configuration of stats and their status in - the metadata under +" +} + +profile_reset_help() +{ + echo "\ - delete Deletes the entry from the metadata, does not affect the stats + Usage: $SCRIPT admin profile reset - reset Resets all the stats to enabled, unloads a profile that is loaded + Remove the currently loaded profile, and re-enable the stats that were disabled by that profile. + The profile isn't deleted. " } push_help() { - echo"\ + echo "\ + + Setup an endpoint with udp in order to poll the stats in exometer and send to endpoint. + + setup [opts] similar to stat enable , setting up requires + the port number e.g. 8080, serverip == sip, and protocol + -> protocol=udp,port=8080,sip=127.0.0.1 for example + Use setup-port to change ports as well as restarting a port, + Specific stats can be chosen to be pushed, otherwise the + default will poll all stats in exometer. - Endpoint is the stat collector of riak_stat, setup an endpoint with udp in order - to poll the stats in exometer and send to endpoint. + opts :: protocol= udp | tcp + port= + instance= + sip - setup [opts] similar to stat enable , setting up requires - the port number e.g. 8080, serverip == sip, and protocol - -> protocol=udp,port=8080,sip=127.0.0.1 for example - Use setup-port to change ports as well as restarting a port, - Specific stats can be chosen to be pushed, otherwise the - default will poll all stats in exometer. + setdown can be same as above, closes the socket for that protocol - opts :: protocol= udp | tcp - port= - instance= - sip + info can also be the same as above, works in a similar + way to riak stat show, to find the information based + on protocol, instance or whether it is still running etc." +} + +push_setup_help() +{ + echo "\ - setdown can be same as above, closes the socket for that protocol + Usage: $SCRIPT admin push setup protocol=, + port=, + instance=, + sip= + [/stats=] + + Setup polling from node to endpoint; protocol, port, instance and serverip/hostname + must be given, stats are optional, default : riak.** (all stats in riak). + + :: tcp | udp (http not supported) + :: 0..65535 + :: Server instance + :: IP address / hostname + For the formatting on see \`riak admin stat help show\` for more details. + + Example: + \$ riak admin push setup protocol=tcp,port=9090,sip=127.0.0.1,instance=testingtcp + Polling Started + + " +} + +push_setdown_help() +{ + echo "\ + + Usage: $SCRIPT admin push setdown [protocol=] + [,port=] + [,instance=] + [,sip=] + + Setdown polling on the node; protocol, port, instance or serverip/hostname + must be given, as multiple instances of polling can be running it is better to + give the instance name if known to be specific to one process. + + :: tcp | udp (http not supported) + :: 0..65535 + :: Server instance + :: IP address / hostname + + Example: Stopping all tcp polling instances + \$ riak admin push setdown protocol=tcp + Polling Stopped for : [,...] + Example: Stopping all instances on local IP + \$ riak admin push setdown sip=127.0.0.1 + Polling Stopped for : [,...] + Example: Stopping Polling using instance name + \$ riak admin push setdown instance=testingtcp + Polling Stopped for: testingtcp + + " +} +push_info_help() +{ + echo "\ - find-info can also be the same as above, works in a similar - way to riak stat show, to find the information based - on protocol, instance or whether it is still running etc. + Usage: $SCRIPT admin push info [protocol=] + [,port=] + [,instance=] + [,sip=] + [/stats=] + + find all the instances of the options given, works in a similar way + to \`riak admin stat show\` and \`riak admin stat info\`. + + Protocol has to be entered. If the protocol does not matter then * can be used. + The other options are optional. The Dates and times of when the instance was + started is displayed as well as if it is still running. + + :: tcp | udp | * (http not supported) + :: 0..65535 + :: Server instance + :: IP address / hostname + For the formatting on see \`riak admin stat help show\` for more details. + + Example: finding tcp protocols + \$ riak admin push info protocol=tcp + Example: finding instances on port 8000 + \$ riak admin push info protocol=*,port=8000 + Example: finding instances on run locally for udp + \$ riak admin push info protocol=udp,sip=127.0.0.1 " } From e9eebedf53dff53b3bd93bd84998baf40ec7af2c Mon Sep 17 00:00:00 2001 From: banana Date: Fri, 1 Nov 2019 11:47:02 +0000 Subject: [PATCH 18/40] changes --- apps/riak/src/riak.app.src | 7 +++---- rebar.config | 4 ++-- rel/files/riak-admin | 4 ++++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/riak/src/riak.app.src b/apps/riak/src/riak.app.src index 30b7016bd..cf787cea0 100644 --- a/apps/riak/src/riak.app.src +++ b/apps/riak/src/riak.app.src @@ -7,7 +7,6 @@ kernel, stdlib, lager, - riak_stat, sasl, public_key, ssl, @@ -19,8 +18,8 @@ lager_syslog, cluster_info, riak_kv, - riak_repl, - riak_auth_mods - ]}, + + riak_repl, + riak_auth_mods ]}, {env, []} ]}. diff --git a/rebar.config b/rebar.config index 8f7d19d51..28c58ba7c 100644 --- a/rebar.config +++ b/rebar.config @@ -16,8 +16,8 @@ {riak_kv, {git, "git://github.com/basho/riak_kv.git", {branch, "develop-3.0-riak_stat"}}}, {riak_auth_mods, {git, "git://github.com/basho/riak_auth_mods.git", {branch, "develop-3.0"}}}, {riak_repl, {git, "git://github.com/basho/riak_repl.git", {branch, "develop-3.0-riak_stat"}}}, - {yokozuna, {git, "git://github.com/basho/yokozuna.git", {branch, "develop-3.0-stats-work"}}}, - {riak_stat, {git, "https://github.com/bet365/riak_stat.git", {branch, "develop-3.0-stats-work"}}} + {yokozuna, {git, "git://github.com/basho/yokozuna.git", {branch, "develop-3.0-stats-work"}}} + ]}. {project_plugins, [ diff --git a/rel/files/riak-admin b/rel/files/riak-admin index e129c1bf2..3c8c6bdf7 100755 --- a/rel/files/riak-admin +++ b/rel/files/riak-admin @@ -153,6 +153,10 @@ push_admin() shift relx_nodetool rpc riak_core_console find_push_stats "$*" ;; + info-all) + shift + relx_nodetool rpc riak_core_console find_push_stats_all "$*" + ;; help) shift case "$1" in From 7ebd376484aa22af55df30cb36afaa75473f6b78 Mon Sep 17 00:00:00 2001 From: banana Date: Fri, 1 Nov 2019 11:54:38 +0000 Subject: [PATCH 19/40] removed locked deps --- rebar.lock | 204 ----------------------------------------------------- 1 file changed, 204 deletions(-) delete mode 100644 rebar.lock diff --git a/rebar.lock b/rebar.lock deleted file mode 100644 index d7d2addda..000000000 --- a/rebar.lock +++ /dev/null @@ -1,204 +0,0 @@ -{"1.1.0", -[{<<"basho_stats">>, - {git,"git://github.com/basho/basho_stats.git", - {ref,"176dee0537b5b3aff57646a7379d435ad990488e"}}, - 3}, - {<<"bear">>, - {git,"git://github.com/basho/bear.git", - {ref,"da820a13c607c3f816ee8b83c587266da5389761"}}, - 3}, - {<<"bitcask">>, - {git,"git://github.com/basho/bitcask.git", - {ref,"fa6e5166de683a351ca63f97b6a08c9b815affab"}}, - 1}, - {<<"canola">>, - {git,"git://github.com/basho/canola.git", - {ref,"2cd39378442f3dc727de22289243b3c4d56f25fd"}}, - 1}, - {<<"clique">>, - {git,"git://github.com/basho/clique.git", - {ref,"b11f4e8f0ecb50830d486dd898f41b4a6a7bbf90"}}, - 3}, - {<<"cluster_info">>, - {git,"git://github.com/basho/cluster_info.git", - {ref,"d12dec63294479e70823711fe61ed0dbf9db38c2"}}, - 0}, - {<<"cuttlefish">>, - {git,"https://github.com/basho/cuttlefish.git", - {ref,"1b4381e5f682d88a2f20ddb8511ff35098c40ea5"}}, - 4}, - {<<"ebloom">>, - {git,"git://github.com/basho/ebloom.git", - {ref,"46207eaa38412d1db7913e18a0231efd49372a4a"}}, - 1}, - {<<"edown">>, - {git,"git://github.com/basho/edown.git", - {ref,"754be25f71a04099c83f3ffdff268e70beeb0021"}}, - 3}, - {<<"eleveldb">>, - {git,"git://github.com/basho/eleveldb.git", - {ref,"55e67e0a611b036483ec446a240c94d7f20d6970"}}, - 3}, - {<<"eper">>, - {git,"git://github.com/massemanet/eper.git", - {ref,"17b0f97ea8287b72e8ebbe7132214db182ff1a1d"}}, - 1}, - {<<"eunit_formatters">>, - {git,"git://github.com/seancribbs/eunit_formatters", - {ref,"473e0cd89bf5608e97886a3bdf9047a16edc88f0"}}, - 1}, - {<<"exometer_core">>, - {git,"git://github.com/basho/exometer_core.git", - {ref,"4c43c777266fbf95cb83d2cf50afc555e5e3a7ec"}}, - 1}, - {<<"folsom">>, - {git,"git://github.com/basho/folsom.git", - {ref,"72944523b6467c9f7add5f1c96dd5020424a2681"}}, - 2}, - {<<"fuse">>, - {git,"https://github.com/jlouis/fuse.git", - {ref,"21c6e52ced3af294f2fe636039106068da12eeeb"}}, - 1}, - {<<"gen_fsm_compat">>,{pkg,<<"gen_fsm_compat">>,<<"0.3.0">>},1}, - {<<"getopt">>, - {git,"https://github.com/basho/getopt.git", - {ref,"880030ff0cbecb73ba75a78a7aa0cc1dcb7fe331"}}, - 5}, - {<<"goldrush">>, - {git,"git://github.com/DeadZen/goldrush.git", - {ref,"212299233c7e7eb63a97be2777e1c05ebaa58dbe"}}, - 2}, - {<<"hyper">>, - {git,"git://github.com/basho/hyper", - {ref,"dc9f8754b8fb0961c2e0cccf7ac2c49c46828487"}}, - 1}, - {<<"ibrowse">>, - {git,"git://github.com/cmullaparthi/ibrowse.git", - {ref,"7529807170cf3c8f6a8c5c95526e670420ff591b"}}, - 1}, - {<<"kv_index_tictactree">>, - {git,"https://github.com/martinsumner/kv_index_tictactree.git", - {ref,"55b6a7dd301e948b4518bcb57c6624f3bafc0053"}}, - 1}, - {<<"kvc">>, - {git,"git://github.com/etrepum/kvc.git", - {ref,"5565fe51857747662410cc3c06362ebcf48a2f04"}}, - 1}, - {<<"lager">>, - {git,"git://github.com/erlang-lager/lager.git", - {ref,"bce5504a955e52be8d5cf4b3c6b1fcd898ab5756"}}, - 1}, - {<<"lager_syslog">>, - {git,"git://github.com/basho/lager_syslog.git", - {ref,"6f47723aca5464efaede866acdc23b05579100ed"}}, - 0}, - {<<"leveled">>, - {git,"https://github.com/martinsumner/leveled.git", - {ref,"b2d4d766cddf7c07ee2fbe51245c1e1164a9aed0"}}, - 1}, - {<<"lz4">>, - {git,"https://github.com/szktty/erlang-lz4", - {ref,"6bc5efe93bab327788bcde24374f16044b549dd8"}}, - 2}, - {<<"meck">>, - {git,"git://github.com/basho/meck.git", - {ref,"dde759050eff19a1a80fd854d7375174b191665d"}}, - 3}, - {<<"mochiweb">>, - {git,"git://github.com/mochi/mochiweb.git", - {ref,"23dc11959affd9b0849c2ac0ff4200c1c82aa80c"}}, - 2}, - {<<"parse_trans">>, - {git,"git://github.com/basho/parse_trans.git", - {ref,"4517dfc096908995b479d6d9ed8284315e68b076"}}, - 2}, - {<<"pbkdf2">>, - {git,"git://github.com/basho/erlang-pbkdf2.git", - {ref,"34b5f716fa3ec89ede36d009f7cc8c47bd019dd7"}}, - 3}, - {<<"poolboy">>, - {git,"https://github.com/Kyorai/poolboy.git", - {ref,"58ae8431dcf9cc69045d618417e5e6e74c7e8dde"}}, - 3}, - {<<"ranch">>, - {git,"git://github.com/ninenines/ranch.git", - {ref,"d0fad24657711cf584da61b5163c29fdafbd9201"}}, - 1}, - {<<"riak_api">>, - {git,"git://github.com/basho/riak_api.git", - {ref,"c2b2a6ea03bb05d0020a352634d67036f9a10d15"}}, - 1}, - {<<"riak_auth_mods">>, - {git,"git://github.com/basho/riak_auth_mods.git", - {ref,"a991fd05929237413a641b60fc826412f98e099e"}}, - 0}, - {<<"riak_core">>, - {git,"git://github.com/basho/riak_core.git", - {ref,"aa2cc8660e280516b3c3159061d37f940a65faa9"}}, - 2}, - {<<"riak_dt">>, - {git,"git://github.com/basho/riak_dt.git", - {ref,"96c718d787afaaaad239d22b1685131412b02085"}}, - 1}, - {<<"riak_ensemble">>, - {git,"https://github.com/basho/riak_ensemble", - {ref,"db82d02a50c016a7cbd31f92c417a8b5d8c499d8"}}, - 3}, - {<<"riak_kv">>, - {git,"git://github.com/basho/riak_kv.git", - {ref,"b9b9d62ae0084abccfcfdb2fd4fa701d77e52ec2"}}, - 0}, - {<<"riak_pb">>, - {git,"git://github.com/basho/riak_pb.git", - {ref,"0ba231c63e05607d98de794fc86674cf036e586a"}}, - 2}, - {<<"riak_pipe">>, - {git,"git://github.com/basho/riak_pipe.git", - {ref,"35660e0c9aa9655534d482d393476bf650f10e3d"}}, - 1}, - {<<"riak_repl">>, - {git,"git://github.com/basho/riak_repl.git", - {ref,"318e4367f5283f0d1ea6407770db84c19b4a01cf"}}, - 0}, - {<<"riak_repl_pb_api">>, - {git,"git://github.com/basho/riak_repl_pb_api.git", - {ref,"6c9ce4abd1170ea77c2267addc18e0c5ad72bb1e"}}, - 1}, - {<<"riak_stat">>, - {git,"https://github.com/bet365/riak_stat.git", - {ref,"b60d0c9273a408700c1b6b58eb4ca10631b1ebd2"}}, - 0}, - {<<"riak_sysmon">>,{pkg,<<"riak_sysmon">>,<<"2.1.7">>},3}, - {<<"riakc">>, - {git,"git://github.com/basho/riak-erlang-client", - {ref,"a47f7a01bac76d33f32c907f4a3a675c66239d03"}}, - 1}, - {<<"setup">>, - {git,"git://github.com/basho/setup.git", - {ref,"51ee7c9f64d2bbe9dcbb58c278e8fbfd4d0ca5e2"}}, - 2}, - {<<"sext">>, - {git,"git://github.com/uwiger/sext.git", - {ref,"615eebcf975ec4b4561c6f2b2bc433dabdb2be0f"}}, - 1}, - {<<"sidejob">>, - {git,"git://github.com/basho/sidejob.git", - {ref,"5974fd19eeb08013af297e6320e7f8c7d8818ddf"}}, - 1}, - {<<"syslog">>, - {git,"git://github.com/Vagabond/erlang-syslog", - {ref,"e24c9ee8f7bb3f066ec152c210af10c2c712759a"}}, - 1}, - {<<"webmachine">>, - {git,"git://github.com/webmachine/webmachine.git", - {ref,"f2f48e402ca6e8347485d4412415a69e92edf8e6"}}, - 2}, - {<<"yokozuna">>, - {git,"git://github.com/basho/yokozuna.git", - {ref,"fa7f1cb6e0e29962263df7796bae0e1f634364f7"}}, - 0}]}. -[ -{pkg_hash,[ - {<<"gen_fsm_compat">>, <<"5903549F67D595F58A7101154CBE0FDD46955FBFBE40813F1E53C23A970FF5F4">>}, - {<<"riak_sysmon">>, <<"AF420DF0F7569E1F12BCD465745164CB6189EB93F118D5CDB3F90FEB3F8BF47D">>}]} -]. From 38fbbde539325fd793c9beb33fd9aa659cd7934a Mon Sep 17 00:00:00 2001 From: banana Date: Tue, 5 Nov 2019 17:58:07 +0000 Subject: [PATCH 20/40] added info-all to riak admin push. usage changed to riak admin instead of riak --- rel/files/riak-admin | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rel/files/riak-admin b/rel/files/riak-admin index 3c8c6bdf7..5c9a6daa0 100755 --- a/rel/files/riak-admin +++ b/rel/files/riak-admin @@ -16,8 +16,8 @@ usage() { echo " reip | js-reload | erl-reload | wait-for-service | " echo " ringready | transfers | force-remove | down | push |" echo " cluster-info | member-status | ring-status | vnode-status |" - echo " aae-status | diag | stat | profile | status | transfer-limit | reformat-indexes |" - echo " top [-interval N] [-sort reductions|memory|msg_q] [-lines N] |" + echo " aae-status | diag | stat | profile | push | status | transfer-limit |" + echo " reformat-indexes | top [-interval N] [-sort reductions|memory|msg_q] [-lines N] |" echo " downgrade-objects | security | bucket-type | repair-2i |" echo " search | services | ensemble-status | handoff | set |" echo " show | describe }" @@ -197,7 +197,7 @@ stat_help() ** - matches anything including separators. Quoting is permitted. - Use \`$SCRIPT stat help \` for more details. + Use \`$SCRIPT admin stat help \` for more details. show Show the value(s) of a specific entry or entries show-0 Show the entry or entries that are not updating @@ -514,7 +514,9 @@ push_help() info can also be the same as above, works in a similar way to riak stat show, to find the information based - on protocol, instance or whether it is still running etc." + on protocol, instance or whether it is still running etc. + + info-all Used the same as above but will return information on all nodes" } push_setup_help() From 2fcaf2f5817299a95d47782139a81e2fb4eb8303 Mon Sep 17 00:00:00 2001 From: banana Date: Wed, 6 Nov 2019 09:26:13 +0000 Subject: [PATCH 21/40] Grammar and phrasing. --- rel/files/riak-admin | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rel/files/riak-admin b/rel/files/riak-admin index 5c9a6daa0..46628d711 100755 --- a/rel/files/riak-admin +++ b/rel/files/riak-admin @@ -184,7 +184,7 @@ stat_help() { echo "\ - Usage: $SCRIPT stat + Usage: $SCRIPT admin stat The following commands display, enable/disable and reset statistics. A statistics entry is given either as a 'dotted' exometer name - @@ -403,7 +403,7 @@ stat_metadata_help() Enable or Disable the persistence of stat options and configuration in the metadata. Disabling would mean the status of the stat, i.e. whether - it is enabled or disabled would not be persisted as well, so on reboot the + it is enabled or disabled would not be persisted, meaning on reboot the stat will be enabled as default. " @@ -496,7 +496,7 @@ push_help() { echo "\ - Setup an endpoint with udp in order to poll the stats in exometer and send to endpoint. + Setup an endpoint with udp or tcp in order to poll the stats in exometer and send to an endpoint. setup [opts] similar to stat enable , setting up requires the port number e.g. 8080, serverip == sip, and protocol From 911cbc423cba9e89a400cec8983b4e48ba064af1 Mon Sep 17 00:00:00 2001 From: banana Date: Tue, 26 Nov 2019 16:25:05 +0000 Subject: [PATCH 22/40] added in the [-z ] flag into the push_admin(), stat_admin() and profile_admin() functions, So if nothing has been entered it will return No Argument Entered, saving the journey to riak_stat_console and so a lot of catch all clauses can be removed from the code --- rel/files/riak-admin | 300 +++++++++++++++++++++++-------------------- 1 file changed, 158 insertions(+), 142 deletions(-) diff --git a/rel/files/riak-admin b/rel/files/riak-admin index 46628d711..af094adf4 100755 --- a/rel/files/riak-admin +++ b/rel/files/riak-admin @@ -25,158 +25,174 @@ usage() { profile_admin() { - case "$1" in - load) - shift - relx_nodetool rpc riak_core_console load_profile "$*" - ;; - save) - shift - relx_nodetool rpc riak_core_console add_profile "$*" - ;; - delete) - shift - relx_nodetool rpc riak_core_console remove_profile "$*" - ;; - reset) - shift - relx_nodetool rpc riak_core_console reset_profile "$*" - ;; - help) - shift - case "$1" in - load) - profile_load_help + if [ -n "$2" ]; then + case "$1" in + load) + shift + relx_nodetool rpc riak_core_console load_profile "$*" + ;; + save) + shift + relx_nodetool rpc riak_core_console add_profile "$*" + ;; + delete) + shift + relx_nodetool rpc riak_core_console remove_profile "$*" + ;; + reset) + shift + relx_nodetool rpc riak_core_console reset_profile "$*" + ;; + help) + shift + case "$1" in + load) + profile_load_help + ;; + save) + profile_save_help + ;; + delete) + profile_delete_help + ;; + reset) + profile_reset_help + ;; + *) + profile_help + esac + ;; + *) + profile_help + esac + + elif [ -z "$2" ]; then + echo "No Argument Entered" + fi + +} + + +stat_admin() +{ + if [ -n "$2" ]; then + case "$1" in + show) + shift + relx_nodetool rpc riak_core_console stat_show "$*" + ;; + show-0) + shift + relx_nodetool rpc riak_core_console stat_0 "$*" + ;; + disable-0) + shift + relx_nodetool rpc riak_core_console stat_disable_0 "$*" + ;; + info) + shift + relx_nodetool rpc riak_core_console stat_info "$*" + ;; + enable) + shift + relx_nodetool rpc riak_core_console stat_enable "$*" + ;; + disable) + shift + relx_nodetool rpc riak_core_console stat_disable "$*" + ;; + reset) + shift + relx_nodetool rpc riak_core_console stat_reset "$*" + ;; + metadata) + shift + relx_nodetool rpc riak_core_console stat_metadata "$*" + ;; + help) + shift + case $1 in + show) + stat_show_help + ;; + show-0) + stat_show_0_help + ;; + enable) + stat_enable_help ;; - save) - profile_save_help + disable) + stat_enable_help ;; - delete) - profile_delete_help + disable-0) + stat_disable_0_help + ;; + info) + stat_info_help ;; reset) - profile_reset_help + stat_reset_help + ;; + metadata) + stat_metadata_help ;; *) - profile_help - esac - ;; - *) - profile_help - esac -} - + stat_help + esac + ;; + *) + stat_help + esac -stat_admin() -{ - case "$1" in - show) - shift - relx_nodetool rpc riak_core_console stat_show "$*" - ;; - show-0) - shift - relx_nodetool rpc riak_core_console stat_0 "$*" - ;; - disable-0) - shift - relx_nodetool rpc riak_core_console stat_disable_0 "$*" - ;; - info) - shift - relx_nodetool rpc riak_core_console stat_info "$*" - ;; - enable) - shift - relx_nodetool rpc riak_core_console stat_enable "$*" - ;; - disable) - shift - relx_nodetool rpc riak_core_console stat_disable "$*" - ;; - reset) - shift - relx_nodetool rpc riak_core_console stat_reset "$*" - ;; - metadata) - shift - relx_nodetool rpc riak_core_console stat_metadata "$*" - ;; - help) - shift - case $1 in - show) - stat_show_help - ;; - show-0) - stat_show_0_help - ;; - enable) - stat_enable_help - ;; - disable) - stat_enable_help - ;; - disable-0) - stat_disable_0_help - ;; - info) - stat_info_help - ;; - reset) - stat_reset_help - ;; - metadata) - stat_metadata_help - ;; - *) - stat_help - esac - ;; - *) - stat_help - esac + elif [ -z "$2" ]; then + echo "No Argument Entered" + fi } push_admin() { - case "$1" in - setup) - shift - relx_nodetool rpc riak_core_console setup_endpoint "$*" - ;; - setdown) - shift - relx_nodetool rpc riak_core_console setdown_endpoint "$*" - ;; - info) - shift - relx_nodetool rpc riak_core_console find_push_stats "$*" - ;; - info-all) - shift - relx_nodetool rpc riak_core_console find_push_stats_all "$*" - ;; - help) - shift - case "$1" in - setup) - push_setup_help - ;; - setdown) - push_setdown_help - ;; - info) - push_info_help - ;; - *) - push_help - ;; - esac - ;; - *) - push_help - esac + if [ -n "$2" ]; then + case "$1" in + setup) + shift + relx_nodetool rpc riak_core_console setup_endpoint "$*" + ;; + setdown) + shift + relx_nodetool rpc riak_core_console setdown_endpoint "$*" + ;; + info) + shift + relx_nodetool rpc riak_core_console find_push_stats "$*" + ;; + info-all) + shift + relx_nodetool rpc riak_core_console find_push_stats_all "$*" + ;; + help) + shift + case "$1" in + setup) + push_setup_help + ;; + setdown) + push_setdown_help + ;; + info) + push_info_help + ;; + *) + push_help + ;; + esac + ;; + *) + push_help + esac + + elif [ -z "$2" ]; then + echo "No Argument Entered" + fi } @@ -399,7 +415,7 @@ stat_metadata_help() { echo "\ - Usage $SCRIPT admin stat metadata =enable|disable + Usage $SCRIPT admin stat metadata =enable|disable|status Enable or Disable the persistence of stat options and configuration in the metadata. Disabling would mean the status of the stat, i.e. whether From dae57ea02d62722bb40774884da86fdd4512f215 Mon Sep 17 00:00:00 2001 From: banana Date: Thu, 5 Dec 2019 17:49:13 +0000 Subject: [PATCH 23/40] spacing in the files --- apps/riak/src/riak.app.src | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/riak/src/riak.app.src b/apps/riak/src/riak.app.src index cf787cea0..91da68d59 100644 --- a/apps/riak/src/riak.app.src +++ b/apps/riak/src/riak.app.src @@ -18,8 +18,8 @@ lager_syslog, cluster_info, riak_kv, - - riak_repl, - riak_auth_mods ]}, + riak_repl, + riak_auth_mods + ]}, {env, []} ]}. From 3534ae5a6eec7301032d4e6f68fae339c710737e Mon Sep 17 00:00:00 2001 From: banana Date: Thu, 5 Dec 2019 18:02:33 +0000 Subject: [PATCH 24/40] help functions formatting and phrasing --- rel/files/riak-admin | 54 ++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/rel/files/riak-admin b/rel/files/riak-admin index af094adf4..f48294599 100755 --- a/rel/files/riak-admin +++ b/rel/files/riak-admin @@ -23,6 +23,7 @@ usage() { echo " show | describe }" } +# Stat Profiles see profile_help() profile_admin() { if [ -n "$2" ]; then @@ -72,7 +73,7 @@ profile_admin() } - +# riak admin stat ... stat_admin() { if [ -n "$2" ]; then @@ -149,6 +150,7 @@ stat_admin() fi } +# Polling stats to an endpoint push_admin() { if [ -n "$2" ]; then @@ -202,8 +204,8 @@ stat_help() Usage: $SCRIPT admin stat - The following commands display, enable/disable and reset statistics. - A statistics entry is given either as a 'dotted' exometer name - + The following commands display, enable/disable and reset stats. + A stats entry is given either as a 'dotted' exometer name - with Identifiers separated by periods, '.', e.g. riak.riak_kv.node.gets, or as a 'legacy' name (same as in riak-admin status) - e.g. node_gets. When a legacy name is listed, the corresponding exometer name is shown as well. @@ -228,14 +230,14 @@ stat_help() | -options | -ref | -datapoints ] - riak_stat Functions : + Additional Functions : Enable the persistence of stats and their configuration, as well as house the profiles functionality, gives more control over the use and status of all stats within riak metadata :: enable | disable - Enables or disables the metadata in riak_stat, disabling the - metadata will prevent the persistence of stats configuration + Enables or disables the use of metadata in riak_stat, disabling the + metadata will prevent the persistence of stats configuration " } @@ -260,7 +262,7 @@ stat_show_help() \$ riak admin stat show riak.riak_kv.node.gets [riak,riak_kv,node,gets]: [{count,0},{one,0}] - - 'Legacy name': The stat names used e.g. in \`$SCRIPT status\` can be used + - 'Legacy name': The stat names used e.g. in \`$SCRIPT admin status\` can be used here, but also with wildcard support. The corresponding Exometer name and datapoint will be shown as well. @@ -304,7 +306,7 @@ stat_show_0_help() Shows the Stats in riak, that are not updating or have a value of 0. - See 'riak admin stat help show for the formatting of the , + See 'riak admin stat help show' for the formatting of the , this works in the same way. Example: @@ -348,7 +350,7 @@ stat_disable_0_help() Some stats in exometer might go unused, and will not update often if at all. \`$SCRIPT admin stat disable-0\` disables all the stats in exometer - that are enabled and have not updated at all. + that are enabled and have not updated values at all. The same syntax can be used as in \`stat show\`. The requested action will be performed on the matching entries, in the same way as \`stat disable\`. @@ -375,29 +377,33 @@ stat_info_help() Display Exometer meta-data for matching entries. Type of data can be controlled with options: - info [ -name | -type + info [ -name + | -type | -module - | -value | -cache - | -status | -timestamp - | -options | -ref + | -value + | -cache + | -status + | -timestamp + | -options + | -ref | -datapoints ] The same entry formats can be used as for all other stat subcommands. Example: \$ riak admin stat info riak.riak_kv.node.gets - [riak,riak_kv,node,gets]: name = [riak,riak_kv,node,gets] - type = spiral - module = exometer_spiral - value = disabled - cache = 0 - status = disabled - timestamp = undefined - options = [{status,disabled}] + [riak,riak_kv,node,gets]:[{name,[riak,riak_kv,node,gets]}, + {type,spiral}, + {module,exometer_spiral}, + {value,disabled}, + {cache,0}, + {status,disabled}, + {timestamp,undefined}, + {options,[{status,disabled}]}] \$ riak admin stat info -type -status riak.riak_kv.node.gets - [riak,riak_kv,node,gets]: type = spiral - status = disabled + [riak,riak_kv,node,gets]:[{type,spiral}, + {status,disabled}] " } @@ -415,7 +421,7 @@ stat_metadata_help() { echo "\ - Usage $SCRIPT admin stat metadata =enable|disable|status + Usage $SCRIPT admin stat metadata = enable | disable | status Enable or Disable the persistence of stat options and configuration in the metadata. Disabling would mean the status of the stat, i.e. whether From ff5af524088d9e8c8854105a8e7f5f970b8610f7 Mon Sep 17 00:00:00 2001 From: banana Date: Mon, 6 Jan 2020 10:04:53 +0000 Subject: [PATCH 25/40] removed yokozuna as a dependency --- rebar.config | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rebar.config b/rebar.config index 28c58ba7c..d33ea0ca1 100644 --- a/rebar.config +++ b/rebar.config @@ -15,8 +15,9 @@ {cluster_info, {git, "git://github.com/basho/cluster_info.git", {branch, "develop-3.0"}}}, {riak_kv, {git, "git://github.com/basho/riak_kv.git", {branch, "develop-3.0-riak_stat"}}}, {riak_auth_mods, {git, "git://github.com/basho/riak_auth_mods.git", {branch, "develop-3.0"}}}, - {riak_repl, {git, "git://github.com/basho/riak_repl.git", {branch, "develop-3.0-riak_stat"}}}, - {yokozuna, {git, "git://github.com/basho/yokozuna.git", {branch, "develop-3.0-stats-work"}}} + {riak_repl, {git, "git://github.com/basho/riak_repl.git", {branch, "develop-3.0-riak_stat"}}} + % {riak_pipe, {git, "git://github.com/basho/riak_pipe.git", {branch, "develop-3.0-riak_stat"}}}, + % {yokozuna, {git, "git://github.com/basho/yokozuna.git", {branch, "develop-3.0-stats-work"}}} ]}. @@ -67,7 +68,7 @@ riak_api, riak_repl, cluster_info, - yokozuna, + % yokozuna, riak_auth_mods]}, {dev_mode, false}, From 06d74ead878d46ffd8515dd4e8675a238d7e8ae1 Mon Sep 17 00:00:00 2001 From: Martin Cox Date: Mon, 6 Jan 2020 11:25:36 +0000 Subject: [PATCH 26/40] 3.0 packaging - RPM (#1000) Port files over from node_package for building packages (RPM & DEB). --- Makefile | 17 ++-- rebar.config | 22 +++-- rel/pkg/Makefile | 91 +++++++++++++++++++++ rel/pkg/deb/Makefile | 19 +++++ rel/pkg/deb/compat | 1 + rel/pkg/deb/control | 16 ++++ rel/pkg/deb/copyright | 8 ++ rel/pkg/deb/deb.template | 41 ++++++++++ rel/pkg/deb/dirs | 2 + rel/pkg/deb/init.script | 152 +++++++++++++++++++++++++++++++++++ rel/pkg/deb/install | 10 +++ rel/pkg/deb/package.manpages | 1 + rel/pkg/deb/package.service | 14 ++++ rel/pkg/deb/postinst | 44 ++++++++++ rel/pkg/deb/postrm | 61 ++++++++++++++ rel/pkg/deb/rules | 63 +++++++++++++++ rel/pkg/deb/vars.config | 21 +++++ rel/pkg/out/.gitignore | 4 + rel/pkg/rpm/Makefile | 24 ++++++ rel/pkg/rpm/riak | 17 ++++ rel/pkg/rpm/specfile | 150 ++++++++++++++++++++++++++++++++++ 21 files changed, 765 insertions(+), 13 deletions(-) create mode 100644 rel/pkg/Makefile create mode 100644 rel/pkg/deb/Makefile create mode 100644 rel/pkg/deb/compat create mode 100644 rel/pkg/deb/control create mode 100644 rel/pkg/deb/copyright create mode 100644 rel/pkg/deb/deb.template create mode 100644 rel/pkg/deb/dirs create mode 100755 rel/pkg/deb/init.script create mode 100644 rel/pkg/deb/install create mode 100644 rel/pkg/deb/package.manpages create mode 100644 rel/pkg/deb/package.service create mode 100755 rel/pkg/deb/postinst create mode 100755 rel/pkg/deb/postrm create mode 100755 rel/pkg/deb/rules create mode 100644 rel/pkg/deb/vars.config create mode 100644 rel/pkg/out/.gitignore create mode 100644 rel/pkg/rpm/Makefile create mode 100755 rel/pkg/rpm/riak create mode 100644 rel/pkg/rpm/specfile diff --git a/Makefile b/Makefile index 65abe29cf..ba2bf658e 100644 --- a/Makefile +++ b/Makefile @@ -81,6 +81,9 @@ test : test-deps rel: locked-deps compile $(REBAR) as rel release +rel-rpm: locked-deps compile + $(REBAR) as rpm release + relclean: rm -rf $(REL_DIR) rm -rf rel/riak @@ -256,11 +259,7 @@ get_dist_deps = mkdir distdir && \ # This enables the toplevel repository package to change names # when underlying dependencies change. NAME_HASH = $(shell git hash-object distdir/$(CLONEDIR)/$(MANIFEST_FILE) 2>/dev/null | cut -c 1-8) -ifeq ($(REVISION), $(MAJOR_VERSION)) PKG_ID := $(REPO_TAG) -else -PKG_ID = $(REPO)-$(MAJOR_VERSION)-$(NAME_HASH) -endif # To ensure a clean build, copy the CLONEDIR at a specific tag to a new directory # which will be the basis of the src tar file (and packages) @@ -305,9 +304,13 @@ pkgclean: ballclean # which differs from $REVISION that is repo-- PKG_VERSION = $(shell echo $(PKG_ID) | sed -e 's/^$(REPO)-//') -package: distdir/$(PKG_ID).tar.gz - ln -s distdir package - $(MAKE) -C package -f $(PKG_ID)/deps/node_package/Makefile +package: + git archive --format=tar HEAD | gzip >rel/pkg/out/riak-3.0.tar.gz + $(MAKE) -C rel/pkg/ -f Makefile + +packageclean: + rm -rf rel/pkg/out/* + .PHONY: package export PKG_VERSION PKG_ID PKG_BUILD BASE_DIR ERLANG_BIN REBAR OVERLAY_VARS RELEASE diff --git a/rebar.config b/rebar.config index 9860dde90..64001f14c 100644 --- a/rebar.config +++ b/rebar.config @@ -20,7 +20,7 @@ ]}. {project_plugins, [ - {rebar3_cuttlefish, {git, "https://github.com/martincox/rebar3_cuttlefish", {branch, "fix/output-dir-awareness"}}} + {rebar3_cuttlefish, {git, "https://github.com/martincox/rebar3_cuttlefish", {branch, "fix/runner_dirs"}}} ]}. {cuttlefish, [ @@ -69,11 +69,13 @@ yokozuna, riak_auth_mods]}, + {overlay_vars, "rel/vars.config"}, {dev_mode, false}, {include_erts, true}, {overlay, [ - {mkdir, "lib/riak-patches"}, + {mkdir, "lib/patches"}, + {mkdir, "data/ring"}, {template, "rel/files/advanced.config", "etc/advanced.config"}, @@ -111,14 +113,22 @@ {dialyzer, [{plt_apps, all_deps}]}. {profiles, [ - {rel, [ + {dev, [ {relx, [ - {overlay_vars, "rel/vars.config"} + {dev_mode, true} ]} ]}, - {dev, [ + {rpm, [ {relx, [ - {dev_mode, true} + {overlay_vars, "rpm.vars.config"}, + {overlay, [ + {template, "rel/pkg/rpm/riak", "usr/bin/riak"} + ]} + ]} + ]}, + {deb, [ + {relx, [ + {overlay_vars, "deb.vars.config"} ]} ]} ]}. diff --git a/rel/pkg/Makefile b/rel/pkg/Makefile new file mode 100644 index 000000000..81bf3c246 --- /dev/null +++ b/rel/pkg/Makefile @@ -0,0 +1,91 @@ +## +## Export all variables to sub-invocation +## +export + +OS = $(shell uname -s) +ERLANG_BIN ?= $(shell dirname $(shell which erl)) +DEPS_DIR ?= deps + +## +## Support RPM and Debian based linux systems +## +ifeq ($(OS),Linux) +ARCH = $(shell uname -m) +ISRPM = $(shell cat /etc/redhat-release 2> /dev/null) +ISDEB = $(shell cat /etc/debian_version 2> /dev/null) +ISSLES = $(shell cat /etc/SuSE-release 2> /dev/null) +ifneq ($(ISRPM),) +OSNAME = RedHat +PKGERDIR = rpm +BUILDDIR = rpmbuild +else +ifneq ($(ISDEB),) +OSNAME = Debian +PKGERDIR = deb +BUILDDIR = debuild +else +ifneq ($(ISSLES),) +OSNAME = SLES +PKGERDIR = rpm +BUILDDIR = rpmbuild +endif # SLES +endif # deb +endif # rpm +endif # linux + +ifeq ($(OS),Darwin) # OSX +OSNAME = OSX +ARCH = $(shell file `which erlc` | grep -c x86_64 2> /dev/null | awk \ + '{if ($$1 == "0") {print "i386"} else {print "x86_64"}}') +PKGERDIR = osx +BUILDDIR = osxbuild +endif + +ifeq ($(OS),FreeBSD) +OSNAME = FreeBSD +ARCH = $(shell uname -m) +BUILDDIR = fbsdbuild +PKGNG = $(shell uname -r | awk -F. '{ print ($$1 > 9) ? "true" : "false" }') +ifeq ($(PKGNG),true) # FreeBSD 10.0 or greater +PKGERDIR = fbsdng +else # Older FreeBSD pkg_add +PKGERDIR = fbsd +endif +endif + +ifeq ($(OS),SunOS) # Solaris flavors +KERNELVER = $(shell uname -v | grep -c joyent 2> /dev/null) +ARCH = $(shell file `which erlc` | grep -c 64-bit 2> /dev/null | awk \ + '{if ($$1 == "0") {print "i386"} else {print "x86_64"}}') + +ifneq ($(KERNELVER),0) # SmartOS +OSNAME = SmartOS +PKGERDIR = smartos +BUILDDIR = smartosbuild +else # Solaris / OmniOS +DISTRO = $(shell head -1 /etc/release|awk \ + '{if ($$1 == "OmniOS") {print $$1} else {print "Solaris"}}') +OSNAME = ${DISTRO} +PKGERDIR = solaris +BUILDDIR = solarisbuild +endif + +endif + +DATE = $(shell date +%Y-%m-%d) + +# Default the package build version to 1 if not already set +PKG_BUILD ?= 1 + +.PHONY: ostype varcheck + +## Call platform dependent makefile +ostype: varcheck + $(if $(PKGERDIR),,$(error "Operating system '$(OS)' not supported by node_package")) + $(MAKE) -C $(PKGERDIR) -f Makefile + +## Check required settings before continuing +varcheck: + $(if $(PKG_VERSION),,$(error "Variable PKG_VERSION must be set and exported, see basho/node_package readme")) + $(if $(PKG_ID),,$(error "Variable PKG_ID must be set and exported, see basho/node_package readme")) diff --git a/rel/pkg/deb/Makefile b/rel/pkg/deb/Makefile new file mode 100644 index 000000000..79fda8215 --- /dev/null +++ b/rel/pkg/deb/Makefile @@ -0,0 +1,19 @@ + +default: + ln -sf $(PKG_ID).tar.gz ../{{package_name}}_$(PKG_VERSION).orig.tar.gz + export DEBFULLNAME="{{vendor_contact_name}}"; \ + export DEBEMAIL="{{vendor_contact_email}}"; \ + dch --create --package {{package_name}} -v "$(PKG_VERSION)-$(PKG_BUILD)" \ + "Build from $(PKG_VERSION)";\ + debuild --prepend-path=$(ERLANG_BIN) \ + -e REVISION=$(PKG_VERSION) \ + -e RELEASE=$(PKG_BUILD) \ + -e REBAR=$(REBAR) \ + {{debuild_extra_options}} \ + -uc -us + mkdir -p ../packages + cd .. && mv *$(PKG_VERSION)-$(PKG_BUILD)_*.deb packages + cd ../packages && \ + for debfile in *.deb; do \ + sha256sum $${debfile} > $${debfile}.sha \ + ; done diff --git a/rel/pkg/deb/compat b/rel/pkg/deb/compat new file mode 100644 index 000000000..7f8f011eb --- /dev/null +++ b/rel/pkg/deb/compat @@ -0,0 +1 @@ +7 diff --git a/rel/pkg/deb/control b/rel/pkg/deb/control new file mode 100644 index 000000000..37090553f --- /dev/null +++ b/rel/pkg/deb/control @@ -0,0 +1,16 @@ +Source: {{package_name}} +Section: net +Priority: extra +Maintainer: {{vendor_contact_name}} <{{vendor_contact_email}}> +Build-Depends: debhelper (>= 7) +Standards-Version: 3.9.3 +Homepage: {{vendor_url}} + +Package: {{package_name}} +Architecture: any +Depends: ${misc:Depends}, ${shlibs:Depends}, adduser, logrotate, sudo, {{deb_depends}} +Homepage: {{vendor_url}} +Description: {{package_shortdesc}} + {{package_desc}} +{{package_replacement_line}} +{{package_conflicts_line}} diff --git a/rel/pkg/deb/copyright b/rel/pkg/deb/copyright new file mode 100644 index 000000000..d02cb9889 --- /dev/null +++ b/rel/pkg/deb/copyright @@ -0,0 +1,8 @@ +Format: http://dep.debian.net/deps/dep5 +Upstream-Name: {{package_name}} +Upstream-Contact: {{vendor_contact_name}} <{{vendor_contact_email}}> + +Files: * +Copyright: {{copyright}} +License: {{license_type}} + {{license_full_text}} diff --git a/rel/pkg/deb/deb.template b/rel/pkg/deb/deb.template new file mode 100644 index 000000000..1f0c07c13 --- /dev/null +++ b/rel/pkg/deb/deb.template @@ -0,0 +1,41 @@ +%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*- +%% +{variables, [ + {package_name, "package_name"}, + {package_install_name, "package_install_name"}, + {package_install_user, "package_install_user"}, + {package_install_user_desc, "package_install_user_desc"}, + {package_install_group, "package_install_group"}, + {package_replacement_line, "{{package_replacement_line_debian}}"}, + {package_conflicts_line, "{{package_conflicts_line_debian}}"}, + {vendor_name, "vendor_name"}, + {vendor_url, "vendor_url"}, + {vendor_contact_name, "vendor_contact_name"}, + {vendor_contact_email, "vendor_contact_email"}, + {copyright, "copyright"}, + {license_type, "license_type"}, + {license_full_text, ""}, + {bin_or_sbin, "bin"}, + + %% Platform Specific Settings + {platform_bin_dir, "/usr/{{bin_or_sbin}}"}, + {platform_data_dir, "/var/lib/{{package_install_name}}"}, + {platform_etc_dir, "/etc/{{package_install_name}}"}, + {platform_base_dir, "/usr/lib/{{package_install_name}}"}, + {platform_lib_dir, "/usr/lib/{{package_install_name}}/lib"}, + {platform_log_dir, "/var/log/{{package_install_name}}"} + ] +}. +{template, "Makefile", "Makefile"}. +{template, "compat", "compat"}. +{template, "control", "control"}. +{template, "copyright", "copyright"}. +{template, "dirs", "dirs"}. +{template, "install", "install"}. +{template, "postinst", "postinst"}. +{template, "postrm", "postrm"}. +{template, "rules", "rules"}. +{template, "vars.config", "vars.config"}. +{template, "init.script", "{{package_name}}.{{package_install_name}}.init"}. +{template, "package.service", "{{package_name}}.{{package_install_name}}.service"}. +{template, "package.manpages", "{{package_name}}.manpages"}. diff --git a/rel/pkg/deb/dirs b/rel/pkg/deb/dirs new file mode 100644 index 000000000..3220e0d31 --- /dev/null +++ b/rel/pkg/deb/dirs @@ -0,0 +1,2 @@ +etc/logrotate.d +var/log/{{package_install_name}} diff --git a/rel/pkg/deb/init.script b/rel/pkg/deb/init.script new file mode 100755 index 000000000..c0fbd9055 --- /dev/null +++ b/rel/pkg/deb/init.script @@ -0,0 +1,152 @@ +#! /bin/bash +### BEGIN INIT INFO +# Provides: {{package_name}} +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: {{package_shortdesc}} +# Description: {{package_desc}} +### END INIT INFO + +NAME={{package_install_name}} +DAEMON=/usr/{{bin_or_sbin}}/$NAME +SCRIPTNAME=/etc/init.d/$NAME +RUNDIR=/var/run/$NAME + +# Read configuration variable file if it is present +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +# Load the VERBOSE setting and other rcS variables +. /lib/init/vars.sh +. /lib/lsb/init-functions + +# `service` strips all environmental VARS so +# if no HOME was set in /etc/default/$NAME then set one here +# to the data directory for erlexec's sake +if [ -z "$HOME" ]; then + export HOME={{platform_data_dir}} +fi + +# +# Function that starts the daemon/service +# +do_start() +{ + if [ ! -d $RUNDIR ]; then + mkdir $RUNDIR + chown {{package_install_user}}:{{package_install_group}} $RUNDIR + fi + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + + # Startup with the appropriate user + start-stop-daemon --start \ + --name {{package_install_name}} \ + --user {{package_install_user}} \ + --exec $DAEMON -- start \ + || return 2 +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Identify the erts directory + ERTS_PATH=`$DAEMON ertspath` + + # Attempt a clean shutdown. + $DAEMON stop + + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + # Make sure it's down by using a more direct approach + start-stop-daemon --stop \ + --quiet \ + --retry=TERM/30/KILL/5 \ + --user {{package_install_user}} \ + --exec $ERTS_PATH/run_erl + return $? +} + +# +# Function that graceful reload the daemon/service +# +do_reload() { + # Restart the VM without exiting the process + $DAEMON restart && return $? || return 2 +} + +# Checks the status of a node +do_status() { + $DAEMON ping && echo $"$NAME is running" && return 0 + echo $"$NAME is stopped" && return 2 +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $NAME" + $DAEMON ping >/dev/null 2>&1 && echo $"$NAME is already running" && exit 0 + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 + exit 1 + ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 + exit 1 + ;; + esac + ;; + ping) + # See if the VM is alive + $DAEMON ping || exit $? + ;; + reload|force-reload) + log_daemon_msg "Reloading $NAME" + do_reload + ES=$? + log_end_msg $ES + exit $ES + ;; + restart) + log_daemon_msg "Restarting $NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 && exit 1 ;; # Old process is still running + *) log_end_msg 1 && exit 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 && exit 1 + ;; + esac + ;; + status) + do_status && exit 0 || exit $? + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|ping|restart|force-reload|status}" >&2 + exit 3 + ;; +esac + +: diff --git a/rel/pkg/deb/install b/rel/pkg/deb/install new file mode 100644 index 000000000..5f314b5f2 --- /dev/null +++ b/rel/pkg/deb/install @@ -0,0 +1,10 @@ +rel/{{package_install_name}}/lib usr/lib/{{package_install_name}} +rel/{{package_install_name}}/erts* usr/lib/{{package_install_name}} +rel/{{package_install_name}}/releases usr/lib/{{package_install_name}} + +{{#package_commands}} +rel/{{package_install_name}}/bin/{{name}} usr/{{bin_or_sbin}} +{{/package_commands}} + +rel/{{package_install_name}}/etc/* etc/{{package_install_name}} +rel/{{package_install_name}}/data/* var/lib/{{package_install_name}} \ No newline at end of file diff --git a/rel/pkg/deb/package.manpages b/rel/pkg/deb/package.manpages new file mode 100644 index 000000000..e3db37c1b --- /dev/null +++ b/rel/pkg/deb/package.manpages @@ -0,0 +1 @@ +doc/man/man1/*.1.gz \ No newline at end of file diff --git a/rel/pkg/deb/package.service b/rel/pkg/deb/package.service new file mode 100644 index 000000000..751414252 --- /dev/null +++ b/rel/pkg/deb/package.service @@ -0,0 +1,14 @@ +[Unit] +Description={{package_shortdesc}} + +[Service] +ExecStart=/usr/{{bin_or_sbin}}/{{package_install_name}} start +ExecStop=/usr/{{bin_or_sbin}}/{{package_install_name}} stop +User={{package_install_user}} +Type=forking +PIDFile=/var/run/{{package_install_name}}/{{package_install_name}}.pid +EnvironmentFile=-/etc/default/{{package_install_name}} +RuntimeDirectory={{package_install_name}} + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/rel/pkg/deb/postinst b/rel/pkg/deb/postinst new file mode 100755 index 000000000..88f272a5f --- /dev/null +++ b/rel/pkg/deb/postinst @@ -0,0 +1,44 @@ +#!/bin/sh +# postinst script for {{package_name}} +# +# see: dh_installdeb(1) + +set -e + +# create group +if ! getent group {{package_install_group}} >/dev/null; then + addgroup --system {{package_install_group}} +fi + +# create user +if ! getent passwd {{package_install_user}} >/dev/null; then + adduser --ingroup {{package_install_group}} \ + --home /var/lib/{{package_install_name}} \ + --disabled-password \ + --system --shell /bin/bash --no-create-home \ + --gecos "{{package_install_user_desc}}" {{package_install_user}} +fi + +for i in lib log; do + chown -R {{package_install_user}}:{{package_install_group}} /var/$i/{{package_install_name}} +done + +case "$1" in + configure) + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/rel/pkg/deb/postrm b/rel/pkg/deb/postrm new file mode 100755 index 000000000..df83a1fb8 --- /dev/null +++ b/rel/pkg/deb/postrm @@ -0,0 +1,61 @@ +#!/bin/sh +# postrm script for {{package_name}} +# +# see: dh_installdeb(1) + + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +set -e + +case "$1" in + purge) + rm -f /etc/default/{{package_install_name}} + if [ -d /var/log/{{package_install_name}} ]; then + rm -r /var/log/{{package_install_name}} + fi + if [ -d /var/run/{{package_install_name}} ]; then + rm -r /var/run/{{package_install_name}} + fi + if [ -d /etc/{{package_install_name}} ]; then + rm -r /etc/{{package_install_name}} + fi + if [ -e /etc/init.d/{{package_install_name}} ]; then + rm /etc/init.d/{{package_install_name}} + fi + # Remove User & Group, killing any process owned by them + if getent passwd {{package_install_user}} >/dev/null; then + pkill -u {{package_install_user}} || true + deluser --quiet --system {{package_install_user}} + fi + if getent group {{package_install_group}} >/dev/null; then + delgroup --quiet --system --only-if-empty {{package_install_group}} || true + fi + ;; + + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1\`" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/rel/pkg/deb/rules b/rel/pkg/deb/rules new file mode 100755 index 000000000..d06fee81f --- /dev/null +++ b/rel/pkg/deb/rules @@ -0,0 +1,63 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# modified for node_package by dizzyd@basho.com and jared@basho.com + +# Uncomment this to turn on verbose mode. +export DH_VERBOSE=1 + +ROOTDIR := debian/{{package_name}} + +## Clear variables that may confound our build of sub-projects; also +## note that it is necessary to use overlay_vars relative to .. as +## the generate command EXECUTES in rel/ +build: + unset CC CFLAGS CPPFLAGS LDFLAGS CXX CXXFLAGS \ + && OVERLAY_VARS="overlay_vars=../debian/vars.config" make rel + touch build + +clean: + dh_clean + rm -f build + make clean + +## dh_shlibdeps was added to figure out the dependencies on shared libraries +## and will populate the ${shlibs:Depends} callout in the control file +install: LIBDIR := $(ROOTDIR)/usr/lib/{{package_install_name}} +install: build + dh_testdir + dh_testroot + dh_prep + dh_installdirs + dh_install + dh_installman + dh_installinit --name={{package_install_name}} --no-start + dh_fixperms + chmod 0755 $(ROOTDIR)/etc/{{package_install_name}} + chmod -R a+rX $(ROOTDIR)/etc/{{package_install_name}} + for file in lib/env.sh lib/app_epath.sh erts-*/bin/nodetool; do \ + if [ -f $(LIBDIR)/$$file ]; then \ + chmod 0755 $(LIBDIR)/$$file; \ + fi; \ + done + chmod -R go+rX debian/{{package_name}}/usr/lib/{{package_install_name}}/lib/ + dh_shlibdeps + +# We have nothing to do by default. +binary-indep: install build-stamp +build-stamp: + +# Build architecture-dependent files here. +binary-arch: install + dh_strip -a + dh_compress -a + dh_installdeb + dh_gencontrol + dh_builddeb + +binary: binary-indep binary-arch diff --git a/rel/pkg/deb/vars.config b/rel/pkg/deb/vars.config new file mode 100644 index 000000000..6e3f56ed4 --- /dev/null +++ b/rel/pkg/deb/vars.config @@ -0,0 +1,21 @@ +%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*- +%% ex: ft=erlang ts=4 sw=4 et + +%% Platform-specific installation paths +{platform_bin_dir, "{{platform_bin_dir}}"}. +{platform_data_dir, "{{platform_data_dir}}"}. +{platform_etc_dir, "{{platform_etc_dir}}"}. +{platform_base_dir, "{{platform_base_dir}}"}. +{platform_lib_dir, "{{platform_lib_dir}}"}. +{platform_log_dir, "{{platform_log_dir}}"}. + +{runner_script_dir, "{{platform_bin_dir}}"}. +{runner_base_dir, "{{platform_base_dir}}"}. +{runner_etc_dir, "{{platform_etc_dir}}"}. +{runner_log_dir, "{{platform_log_dir}}"}. +{runner_user, "{{package_install_user}}"}. +{runner_lib_dir, "{{platform_lib_dir}}"}. +{runner_patch_dir, "{{platform_lib_dir}}/{{package_patch_dir}}"}. +{pipe_dir, "/tmp/{{package_install_name}}/"}. +{package_replacement_line, "{{package_replacement_line_debian}}"}. +{package_conflicts_line, "{{package_replacement_line_debian}}"}. diff --git a/rel/pkg/out/.gitignore b/rel/pkg/out/.gitignore new file mode 100644 index 000000000..5e7d2734c --- /dev/null +++ b/rel/pkg/out/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore diff --git a/rel/pkg/rpm/Makefile b/rel/pkg/rpm/Makefile new file mode 100644 index 000000000..19e50e426 --- /dev/null +++ b/rel/pkg/rpm/Makefile @@ -0,0 +1,24 @@ + +PWD = $(shell pwd) + + +# No hyphens are allowed in the _version field in RPM +PKG_VERSION_NO_H ?= $(shell echo $(PKG_VERSION) | tr - .) + +default: + rpmbuild --define "_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}$(DISTRO)%%{ARCH}.rpm" \ + --define '_topdir $(BASE_DIR)/rel/pkg/out/' \ + --define '_sourcedir $(BASE_DIR)/rel/pkg/out/' \ + --define '_specdir $(BASE_DIR)/rel/pkg/out/' \ + --define '_rpmdir $(BASE_DIR)/rel/pkg/out/packages' \ + --define '_srcrpmdir $(BASE_DIR)/rel/pkg/out/packages' \ + --define "_revision $(PKG_VERSION)" \ + --define "_version $(PKG_VERSION_NO_H)" \ + --define "_release $(PKG_BUILD)" \ + --define "_tarname riak-$(PKG_ID).tar.gz" \ + --define "_tarname_base riak-$(PKG_ID)" \ + -ba specfile + cd $(BASE_DIR)/rel/pkg/out/packages && \ + for rpmfile in *.rpm; do \ + sha256sum $${rpmfile} > $${rpmfile}.sha \ + ; done diff --git a/rel/pkg/rpm/riak b/rel/pkg/rpm/riak new file mode 100755 index 000000000..3a6372f53 --- /dev/null +++ b/rel/pkg/rpm/riak @@ -0,0 +1,17 @@ +#!/bin/sh + +COMMAND={{platform_bin_dir}}/riak + +if [[ $EUID -ne 0 ]]; then + echo "You need to be root or use sudo to run this command." + exit 1 +fi + +case "$1" in + start|console|foreground) + su - riak -c "PIPE_DIR=${PIPE_DIR} ${COMMAND} ${*} -pa {{platform_lib_dir}}/patches" + ;; + *) + su - riak -c "PIPE_DIR=${PIPE_DIR} ${COMMAND} ${*}" + ;; +esac diff --git a/rel/pkg/rpm/specfile b/rel/pkg/rpm/specfile new file mode 100644 index 000000000..d6001015f --- /dev/null +++ b/rel/pkg/rpm/specfile @@ -0,0 +1,150 @@ +## ------------------------------------------------------------------- +## +## Copyright (c) 2014 Basho Technologies, Inc. +## +## This file is provided to you under the Apache License, +## Version 2.0 (the "License"); you may not use this file +## except in compliance with the License. You may obtain +## a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, +## software distributed under the License is distributed on an +## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +## KIND, either express or implied. See the License for the +## specific language governing permissions and limitations +## under the License. +## +## ------------------------------------------------------------------- + +Name: riak +Version: %{_version} +Release: %{_release}%{?dist} +License: "Apacke 2.0" +Group: Development/Libraries +Source: %{_tarname} +URL: "https://riak.com" +Vendor: "Riak" +Packager: "Riak Package Maint" <"packaging@riak.com"> +BuildRoot: %{_tmppath}/%{name}-%{_revision}-%{release}-root +Summary: "Riak is a distributed data store" +Obsoletes: riak + +%description +"Riak is a distributed data store" + +%define init_script %{_sysconfdir}/init.d/riak +%define debug_package %{nil} +%define __prelink_undo_cmd /bin/cat prelink library + +%define platform_data_dir %{_localstatedir}/lib/riak +%define platform_etc_dir %{_sysconfdir}/riak +%define platform_base_dir %{_libdir}/riak +%define platform_bin_dir %{platform_base_dir}/bin +%define platform_lib_dir %{platform_base_dir}/lib +%define platform_log_dir %{_localstatedir}/log/riak + + +%prep +%setup -q -n %{_tarname_base} -c %{_tarname_base} + +# Setup vars.config like other platforms, but do it inside of spec file +cat > rpm.vars.config </dev/null 2>&1; then + groupadd -r riak +fi + +if getent passwd riak >/dev/null 2>&1; then + usermod -d %{_localstatedir}/lib/riak riak || true +else + useradd -r -g riak \ + --home %{_localstatedir}/lib/riak \ + --comment "Riak User" \ + --shell /bin/bash \ + riak +fi + + +%post +# Post Installation Script + +# For distros with SELinux (RHEL/Fedora) +if [ `which selinuxenabled > /dev/null 2>&1` ] ; then + # Fixup perms for SELinux (if it is enabled) + selinuxenabled && find %{_localstatedir}/lib/riak -name "*.so" -exec chcon -t textrel_shlib_t {} \; +fi + +%preun +# Pre-uninstall script + +# Only on uninstall, not upgrades +if [ "$1" = 0 ] ; then + /sbin/service riak stop > /dev/null 2>&1 +fi +exit 0 + + +# Man pages are optional and might be missing, read from file +%files +%defattr(-,riak,riak) +%{_localstatedir}/lib/riak +%{_localstatedir}/log/riak +%{_libdir}/* +%defattr(-,root,root) +%dir %{_sysconfdir}/riak +/usr/bin/* +%config(noreplace) %{_sysconfdir}/riak/* + +%clean +#rm -rf %{buildroot} From 0b930bb867c4f60f74a813801e62a2b991c7b9a2 Mon Sep 17 00:00:00 2001 From: banana Date: Mon, 6 Jan 2020 11:59:10 +0000 Subject: [PATCH 27/40] removed yokozuna --- apps/riak/src/riak.app.src | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/riak/src/riak.app.src b/apps/riak/src/riak.app.src index 91da68d59..c2bbb7fc4 100644 --- a/apps/riak/src/riak.app.src +++ b/apps/riak/src/riak.app.src @@ -17,8 +17,10 @@ runtime_tools, lager_syslog, cluster_info, + % riak_core, riak_kv, riak_repl, + % riak_pipe, riak_auth_mods ]}, {env, []} From ce779adc859256b50db857fdc4493a1f95af7356 Mon Sep 17 00:00:00 2001 From: banana Date: Mon, 6 Jan 2020 16:22:41 +0000 Subject: [PATCH 28/40] build fix --- apps/riak/src/riak.app.src | 4 ++-- rebar.config | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/riak/src/riak.app.src b/apps/riak/src/riak.app.src index e9096bc99..d140fa103 100644 --- a/apps/riak/src/riak.app.src +++ b/apps/riak/src/riak.app.src @@ -17,10 +17,10 @@ runtime_tools, lager_syslog, cluster_info, - % riak_core, + riak_core, riak_kv, riak_repl, - % riak_pipe, + riak_pipe, riak_auth_mods ]}, {env, []} diff --git a/rebar.config b/rebar.config index 4800ccdef..6272e2010 100644 --- a/rebar.config +++ b/rebar.config @@ -15,9 +15,9 @@ {cluster_info, {git, "git://github.com/basho/cluster_info.git", {branch, "develop-3.0"}}}, {riak_kv, {git, "git://github.com/basho/riak_kv.git", {branch, "develop-3.0-riak_stat"}}}, {riak_auth_mods, {git, "git://github.com/basho/riak_auth_mods.git", {branch, "develop-3.0"}}}, - {riak_repl, {git, "git://github.com/basho/riak_repl.git", {branch, "develop-3.0-riak_stat"}}} - % {riak_pipe, {git, "git://github.com/basho/riak_pipe.git", {branch, "develop-3.0-riak_stat"}}}, - % {yokozuna, {git, "git://github.com/basho/yokozuna.git", {branch, "develop-3.0-stats-work"}}} + {riak_repl, {git, "git://github.com/basho/riak_repl.git", {branch, "develop-3.0-riak_stat"}}}, + {riak_pipe, {git, "git://github.com/basho/riak_pipe.git", {branch, "develop-3.0-riak_stat"}}}, + {yokozuna, {git, "git://github.com/basho/yokozuna.git", {branch, "develop-3.0-stats-work"}}} ]}. From e1e63aaade2acc2cd223e634a8d493249af6a671 Mon Sep 17 00:00:00 2001 From: banana Date: Mon, 6 Jan 2020 17:20:08 +0000 Subject: [PATCH 29/40] find riak_core --- apps/riak/src/riak.app.src | 2 -- rebar.config | 1 - 2 files changed, 3 deletions(-) diff --git a/apps/riak/src/riak.app.src b/apps/riak/src/riak.app.src index d140fa103..cfe8b8a6c 100644 --- a/apps/riak/src/riak.app.src +++ b/apps/riak/src/riak.app.src @@ -17,10 +17,8 @@ runtime_tools, lager_syslog, cluster_info, - riak_core, riak_kv, riak_repl, - riak_pipe, riak_auth_mods ]}, {env, []} diff --git a/rebar.config b/rebar.config index 6272e2010..9b4699f92 100644 --- a/rebar.config +++ b/rebar.config @@ -16,7 +16,6 @@ {riak_kv, {git, "git://github.com/basho/riak_kv.git", {branch, "develop-3.0-riak_stat"}}}, {riak_auth_mods, {git, "git://github.com/basho/riak_auth_mods.git", {branch, "develop-3.0"}}}, {riak_repl, {git, "git://github.com/basho/riak_repl.git", {branch, "develop-3.0-riak_stat"}}}, - {riak_pipe, {git, "git://github.com/basho/riak_pipe.git", {branch, "develop-3.0-riak_stat"}}}, {yokozuna, {git, "git://github.com/basho/yokozuna.git", {branch, "develop-3.0-stats-work"}}} ]}. From afd21f585e15b31cd6b7e0117ad9c22db6ae7b0a Mon Sep 17 00:00:00 2001 From: banana Date: Mon, 6 Jan 2020 17:21:34 +0000 Subject: [PATCH 30/40] removed rebar lock --- rebar.lock | 178 ----------------------------------------------------- 1 file changed, 178 deletions(-) delete mode 100644 rebar.lock diff --git a/rebar.lock b/rebar.lock deleted file mode 100644 index 0cefc692f..000000000 --- a/rebar.lock +++ /dev/null @@ -1,178 +0,0 @@ -{"1.1.0", -[{<<"basho_stats">>, - {git,"git://github.com/basho/basho_stats.git", - {ref,"176dee0537b5b3aff57646a7379d435ad990488e"}}, - 2}, - {<<"bear">>,{pkg,<<"bear">>,<<"0.8.7">>},4}, - {<<"bitcask">>, - {git,"git://github.com/basho/bitcask.git", - {ref,"9184f763b135f9ff5061fa3ce1892cefa54cfe3a"}}, - 1}, - {<<"canola">>, - {git,"git://github.com/basho/canola.git", - {ref,"2cd39378442f3dc727de22289243b3c4d56f25fd"}}, - 1}, - {<<"clique">>, - {git,"git://github.com/basho/clique.git", - {ref,"dc282124f4371f5d0bb8514aea9d033d98d83dd3"}}, - 2}, - {<<"cluster_info">>, - {git,"git://github.com/basho/cluster_info.git", - {ref,"18ed572102055626c1597339015d6501989df287"}}, - 0}, - {<<"cuttlefish">>, - {git,"https://github.com/basho/cuttlefish.git", - {ref,"1b4381e5f682d88a2f20ddb8511ff35098c40ea5"}}, - 3}, - {<<"ebloom">>, - {git,"git://github.com/basho/ebloom.git", - {ref,"3c25f9ef61a73d5f1d2c2601da464dd03975721d"}}, - 1}, - {<<"eleveldb">>, - {git,"git://github.com/basho/eleveldb.git", - {ref,"5ca7491c947d24c764eb0a359370e83dcc0bb021"}}, - 2}, - {<<"exometer_core">>,{pkg,<<"exometer_core">>,<<"1.5.7">>},2}, - {<<"folsom">>,{pkg,<<"folsom">>,<<"0.8.7">>},3}, - {<<"fuse">>, - {git,"https://github.com/jlouis/fuse.git", - {ref,"21c6e52ced3af294f2fe636039106068da12eeeb"}}, - 1}, - {<<"gen_fsm_compat">>,{pkg,<<"gen_fsm_compat">>,<<"0.3.0">>},1}, - {<<"getopt">>, - {git,"https://github.com/basho/getopt.git", - {ref,"880030ff0cbecb73ba75a78a7aa0cc1dcb7fe331"}}, - 4}, - {<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.9">>},2}, - {<<"hut">>,{pkg,<<"hut">>,<<"1.2.1">>},3}, - {<<"hyper">>, - {git,"git://github.com/basho/hyper", - {ref,"d0bf3d67fd17b8ed2610b266aebd54b1027ea916"}}, - 1}, - {<<"ibrowse">>, - {git,"git://github.com/basho/ibrowse.git", - {ref,"893864e25573b4ccd31a82b9412639751733ba40"}}, - 1}, - {<<"kv_index_tictactree">>, - {git,"https://github.com/martinsumner/kv_index_tictactree.git", - {ref,"b2423eaf11493eb51fc8089a843f8c24d951404b"}}, - 1}, - {<<"kvc">>, - {git,"git://github.com/etrepum/kvc.git", - {ref,"5565fe51857747662410cc3c06362ebcf48a2f04"}}, - 1}, - {<<"lager">>, - {git,"git://github.com/erlang-lager/lager.git", - {ref,"22e62f28e5afabe90a6f31bcde367a2b5799fc94"}}, - 1}, - {<<"lager_syslog">>, - {git,"git://github.com/basho/lager_syslog.git", - {ref,"5c90466b25e5947020b09547e38439167e88363c"}}, - 0}, - {<<"leveled">>, - {git,"https://github.com/martinsumner/leveled.git", - {ref,"432fe71bf09987f52fc407a776c23e8eca802451"}}, - 1}, - {<<"lz4">>, - {git,"https://github.com/szktty/erlang-lz4", - {ref,"6bc5efe93bab327788bcde24374f16044b549dd8"}}, - 2}, - {<<"mochiweb">>, - {git,"git://github.com/martinsumner/mochiweb.git", - {ref,"1c1d621632ce924b82bc733697d4115af91fc30f"}}, - 2}, - {<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.0">>},3}, - {<<"pbkdf2">>, - {git,"git://github.com/basho/erlang-pbkdf2.git", - {ref,"34b5f716fa3ec89ede36d009f7cc8c47bd019dd7"}}, - 2}, - {<<"poolboy">>, - {git,"https://github.com/Kyorai/poolboy.git", - {ref,"58ae8431dcf9cc69045d618417e5e6e74c7e8dde"}}, - 2}, - {<<"ranch">>, - {git,"git://github.com/ninenines/ranch.git", - {ref,"d0fad24657711cf584da61b5163c29fdafbd9201"}}, - 1}, - {<<"recon">>, - {git,"https://github.com/ferd/recon", - {ref,"75d70c7c08926d2f24f1ee6de14ee50fe8a52763"}}, - 1}, - {<<"redbug">>, - {git,"https://github.com/massemanet/redbug", - {ref,"c583d4567d1e2b8a540593ad0512559798d42565"}}, - 1}, - {<<"riak_api">>, - {git,"git://github.com/basho/riak_api.git", - {ref,"ada7e27a43ef3e98790df7b607f6dd0f0e4f13df"}}, - 1}, - {<<"riak_auth_mods">>, - {git,"git://github.com/basho/riak_auth_mods.git", - {ref,"a991fd05929237413a641b60fc826412f98e099e"}}, - 0}, - {<<"riak_core">>, - {git,"git://github.com/basho/riak_core.git", - {ref,"b726b0b4c5bbef1a20b95d551d3e32f6dc8741b5"}}, - 1}, - {<<"riak_dt">>, - {git,"git://github.com/basho/riak_dt.git", - {ref,"cdf8cbf3009b7ecb4d659c1576a466cbefe47f55"}}, - 1}, - {<<"riak_ensemble">>, - {git,"https://github.com/basho/riak_ensemble", - {ref,"495833f7a79bb43e288a2a36c9acddfd27e8d90f"}}, - 2}, - {<<"riak_kv">>, - {git,"git://github.com/basho/riak_kv.git", - {ref,"56cb3a1737c373fe4b09ca03681f36e56928a034"}}, - 0}, - {<<"riak_pb">>, - {git,"git://github.com/basho/riak_pb.git", - {ref,"55fab3a2642edf2293228d5a43748a0fc3c8e554"}}, - 1}, - {<<"riak_pipe">>, - {git,"git://github.com/basho/riak_pipe.git", - {ref,"98944cb1b83fa83ab6011e3958252061f48e2172"}}, - 1}, - {<<"riak_repl">>, - {git,"git://github.com/basho/riak_repl.git", - {ref,"8fcc415e89e867ee85a79949869b2497172360a4"}}, - 0}, - {<<"riak_sysmon">>,{pkg,<<"riak_sysmon">>,<<"2.1.7">>},2}, - {<<"riakc">>, - {git,"git://github.com/basho/riak-erlang-client", - {ref,"28b1349d2b9e0cf855baf8142a44815c116f39ad"}}, - 1}, - {<<"setup">>,{pkg,<<"setup">>,<<"2.0.2">>},3}, - {<<"sext">>, - {git,"git://github.com/uwiger/sext.git", - {ref,"615eebcf975ec4b4561c6f2b2bc433dabdb2be0f"}}, - 1}, - {<<"sidejob">>, - {git,"git://github.com/basho/sidejob.git", - {ref,"07dedd9b2043c9c6fd03b78fe8699f0f37418743"}}, - 1}, - {<<"syslog">>, - {git,"git://github.com/Vagabond/erlang-syslog", - {ref,"4a6c6f2c996483e86c1320e9553f91d337bcb6aa"}}, - 1}, - {<<"webmachine">>, - {git,"git://github.com/webmachine/webmachine.git", - {ref,"92225b82fc702f78cf9d23248023ec841272df80"}}, - 2}, - {<<"yokozuna">>, - {git,"git://github.com/basho/yokozuna.git", - {ref,"328265b5beff5e65f5353cd708e3b6b4cc8363cd"}}, - 0}]}. -[ -{pkg_hash,[ - {<<"bear">>, <<"16264309AE5D005D03718A5C82641FCC259C9E8F09ADEB6FD79CA4271168656F">>}, - {<<"exometer_core">>, <<"AB97E34A5D69AB14E6AE161DB4CCA5B5E655E635B842F830EE6AB2CBFCFDC30A">>}, - {<<"folsom">>, <<"A885F0AEEE4C84270954C88A55A5A473D6B2C7493E32FFDC5765412DD555A951">>}, - {<<"gen_fsm_compat">>, <<"5903549F67D595F58A7101154CBE0FDD46955FBFBE40813F1E53C23A970FF5F4">>}, - {<<"goldrush">>, <<"F06E5D5F1277DA5C413E84D5A2924174182FB108DABB39D5EC548B27424CD106">>}, - {<<"hut">>, <<"08D46679523043424870723923971889E8A34D63B2F946A35B46CF921D1236E7">>}, - {<<"parse_trans">>, <<"09765507A3C7590A784615CFD421D101AEC25098D50B89D7AA1D66646BC571C1">>}, - {<<"riak_sysmon">>, <<"AF420DF0F7569E1F12BCD465745164CB6189EB93F118D5CDB3F90FEB3F8BF47D">>}, - {<<"setup">>, <<"1203F4CDA11306C2E34434244576DED0A7BBFB0908D9A572356C809BD0CDF085">>}]} -]. From 60e440ae3d88f02efced08d09fb89887579255eb Mon Sep 17 00:00:00 2001 From: Martin Cox Date: Tue, 7 Jan 2020 14:37:17 +0000 Subject: [PATCH 31/40] Fix devrel. --- Makefile | 2 +- rebar.config | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ba2bf658e..f6551a14b 100644 --- a/Makefile +++ b/Makefile @@ -82,7 +82,7 @@ rel: locked-deps compile $(REBAR) as rel release rel-rpm: locked-deps compile - $(REBAR) as rpm release + $(REBAR) as rel,rpm release relclean: rm -rf $(REL_DIR) diff --git a/rebar.config b/rebar.config index 64001f14c..81d49c700 100644 --- a/rebar.config +++ b/rebar.config @@ -69,7 +69,6 @@ yokozuna, riak_auth_mods]}, - {overlay_vars, "rel/vars.config"}, {dev_mode, false}, {include_erts, true}, @@ -113,9 +112,14 @@ {dialyzer, [{plt_apps, all_deps}]}. {profiles, [ + {rel, [ + {relx, [ + {overlay_vars, "rel/vars.config"} + ]} + ]}, {dev, [ {relx, [ - {dev_mode, true} + {dev_mode, true} ]} ]}, {rpm, [ From 769bd2769faac13231d46a6776d7c72f5f629845 Mon Sep 17 00:00:00 2001 From: Martin Cox Date: Wed, 8 Jan 2020 08:46:18 +0000 Subject: [PATCH 32/40] Update specfile with rebar profile changes. --- rel/pkg/rpm/specfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rel/pkg/rpm/specfile b/rel/pkg/rpm/specfile index d6001015f..fd9a07412 100644 --- a/rel/pkg/rpm/specfile +++ b/rel/pkg/rpm/specfile @@ -64,7 +64,7 @@ EOF make rel-rpm %install -%define relpath %{_builddir}/%{buildsubdir}/_build/rpm/rel/riak +%define relpath %{_builddir}/%{buildsubdir}/_build/rel+rpm/rel/riak %define buildroot_lib %{buildroot}%{_libdir}/riak %define buildroot_etc %{buildroot}%{_sysconfdir}/riak %define buildroot_bin %{buildroot_lib}/bin From 7ba5d06d7feebd3347dcb491a4813672e4404b8c Mon Sep 17 00:00:00 2001 From: Martin Cox Date: Wed, 8 Jan 2020 09:38:55 +0000 Subject: [PATCH 33/40] Fix package tagging. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f6551a14b..e8b70dc33 100644 --- a/Makefile +++ b/Makefile @@ -305,7 +305,7 @@ pkgclean: ballclean PKG_VERSION = $(shell echo $(PKG_ID) | sed -e 's/^$(REPO)-//') package: - git archive --format=tar HEAD | gzip >rel/pkg/out/riak-3.0.tar.gz + git archive --format=tar HEAD | gzip >rel/pkg/out/riak-$(PKG_ID).tar.gz $(MAKE) -C rel/pkg/ -f Makefile packageclean: From d2111a9756bf0ceff7ac071eefcf79affb21cb56 Mon Sep 17 00:00:00 2001 From: banana Date: Fri, 17 Jan 2020 14:13:08 +0000 Subject: [PATCH 34/40] created a new bash script for riak-stat testing now --- apps/riak/src/riak.app.src | 2 - rebar.config | 2 +- rel/files/riak-admin | 622 +--------------------------------- rel/files/riak-stat | 670 +++++++++++++++++++++++++++++++++++++ 4 files changed, 672 insertions(+), 624 deletions(-) create mode 100644 rel/files/riak-stat diff --git a/apps/riak/src/riak.app.src b/apps/riak/src/riak.app.src index d140fa103..cfe8b8a6c 100644 --- a/apps/riak/src/riak.app.src +++ b/apps/riak/src/riak.app.src @@ -17,10 +17,8 @@ runtime_tools, lager_syslog, cluster_info, - riak_core, riak_kv, riak_repl, - riak_pipe, riak_auth_mods ]}, {env, []} diff --git a/rebar.config b/rebar.config index 6272e2010..c3023278a 100644 --- a/rebar.config +++ b/rebar.config @@ -16,7 +16,6 @@ {riak_kv, {git, "git://github.com/basho/riak_kv.git", {branch, "develop-3.0-riak_stat"}}}, {riak_auth_mods, {git, "git://github.com/basho/riak_auth_mods.git", {branch, "develop-3.0"}}}, {riak_repl, {git, "git://github.com/basho/riak_repl.git", {branch, "develop-3.0-riak_stat"}}}, - {riak_pipe, {git, "git://github.com/basho/riak_pipe.git", {branch, "develop-3.0-riak_stat"}}}, {yokozuna, {git, "git://github.com/basho/yokozuna.git", {branch, "develop-3.0-stats-work"}}} ]}. @@ -95,6 +94,7 @@ {generate_start_script, true}, {extended_start_script, true}, {extended_start_script_extensions, [ + {stat, "riak-stat"}, {admin, "riak-admin"}, {debug, "riak-debug"}, {repl, "riak-repl"}, diff --git a/rel/files/riak-admin b/rel/files/riak-admin index 3dc37be77..e1f5d1427 100755 --- a/rel/files/riak-admin +++ b/rel/files/riak-admin @@ -16,621 +16,13 @@ usage() { echo " reip | js-reload | erl-reload | wait-for-service | " echo " ringready | transfers | force-remove | down | push |" echo " cluster-info | member-status | ring-status | vnode-status |" - echo " aae-status | diag | stat | profile | push | status | transfer-limit |" + echo " aae-status | diag | status | transfer-limit |" echo " reformat-indexes | top [-interval N] [-sort reductions|memory|msg_q] [-lines N] |" echo " downgrade-objects | security | bucket-type | repair-2i |" echo " search | services | ensemble-status | handoff | set |" echo " show | describe }" } -# Stat Profiles see profile_help() -profile_admin() -{ - if [ -n "$2" ]; then - case "$1" in - load) - shift - relx_nodetool rpc riak_core_console load_profile "$*" - ;; - save) - shift - relx_nodetool rpc riak_core_console add_profile "$*" - ;; - delete) - shift - relx_nodetool rpc riak_core_console remove_profile "$*" - ;; - reset) - shift - relx_nodetool rpc riak_core_console reset_profile "$*" - ;; - help) - shift - case "$1" in - load) - profile_load_help - ;; - save) - profile_save_help - ;; - delete) - profile_delete_help - ;; - reset) - profile_reset_help - ;; - *) - profile_help - esac - ;; - *) - profile_help - esac - - elif [ -z "$2" ]; then - echo "No Argument Entered" - fi - -} - -# riak admin stat ... -stat_admin() -{ - if [ -n "$2" ]; then - case "$1" in - show) - shift - relx_nodetool rpc riak_core_console stat_show "$*" - ;; - show-0) - shift - relx_nodetool rpc riak_core_console stat_0 "$*" - ;; - disable-0) - shift - relx_nodetool rpc riak_core_console stat_disable_0 "$*" - ;; - info) - shift - relx_nodetool rpc riak_core_console stat_info "$*" - ;; - enable) - shift - relx_nodetool rpc riak_core_console stat_enable "$*" - ;; - disable) - shift - relx_nodetool rpc riak_core_console stat_disable "$*" - ;; - reset) - shift - relx_nodetool rpc riak_core_console stat_reset "$*" - ;; - metadata) - shift - relx_nodetool rpc riak_core_console stat_metadata "$*" - ;; - help) - shift - case $1 in - show) - stat_show_help - ;; - show-0) - stat_show_0_help - ;; - enable) - stat_enable_help - ;; - disable) - stat_enable_help - ;; - disable-0) - stat_disable_0_help - ;; - info) - stat_info_help - ;; - reset) - stat_reset_help - ;; - metadata) - stat_metadata_help - ;; - *) - stat_help - esac - ;; - *) - stat_help - esac - - elif [ -z "$2" ]; then - echo "No Argument Entered" - fi -} - -# Polling stats to an endpoint -push_admin() -{ - if [ -n "$2" ]; then - case "$1" in - setup) - shift - relx_nodetool rpc riak_core_console setup_endpoint "$*" - ;; - setdown) - shift - relx_nodetool rpc riak_core_console setdown_endpoint "$*" - ;; - info) - shift - relx_nodetool rpc riak_core_console find_push_stats "$*" - ;; - info-all) - shift - relx_nodetool rpc riak_core_console find_push_stats_all "$*" - ;; - help) - shift - case "$1" in - setup) - push_setup_help - ;; - setdown) - push_setdown_help - ;; - info) - push_info_help - ;; - *) - push_help - ;; - esac - ;; - *) - push_help - esac - - elif [ -z "$2" ]; then - echo "No Argument Entered" - fi -} - - -stat_help() -{ - echo "\ - - Usage: $SCRIPT admin stat - - The following commands display, enable/disable and reset stats. - A stats entry is given either as a 'dotted' exometer name - with - Identifiers separated by periods, '.', e.g. riak.riak_kv.node.gets, - or as a 'legacy' name (same as in riak-admin status) - e.g. node_gets. - When a legacy name is listed, the corresponding exometer name is shown as well. - - Two kinds of wildcard are suppored: - * - matches anything up to the next separator ('.' or '_') or end of name; - ** - matches anything including separators. - Quoting is permitted. - - Use \`$SCRIPT admin stat help \` for more details. - - show Show the value(s) of a specific entry or entries - show-0 Show the entry or entries that are not updating - disable-0 Disable the entry or entries that are not updating - enable Enable entry or entries - disable Disable entry or entries - reset Reset entry or entries - info [ -name | -type | Display information about the entry or entries. - | -module The attributes are described in the Exometer docs - | -value | -cache - | -status | -timestamp - | -options | -ref - | -datapoints ] - - Additional Functions : - - Enable the persistence of stats and their configuration, as well as house the profiles - functionality, gives more control over the use and status of all stats within riak - - metadata :: enable | disable - Enables or disables the use of metadata in riak_stat, disabling the - metadata will prevent the persistence of stats configuration - -" -} - -stat_show_help() -{ - echo "\ - - Usage: $SCRIPT admin stat show [/type=][/status=][/[,]] - - Show matching stats entries together with corresponding values - - The format of can be one of: - - 'Dotted exometer name': In Exometer, entries are represented as [A,B,...]. - These names can be emulated on the command-line as A.B.... Wildcards are - supported: '*' will match anything between deliminators (dots), whereas - '**' will match anything including deliminators. Thus \`stat show \"*.**\"\` - will match all stats entries. All Riak stat entry names start with 'riak', - so \`stat show riak.**\` will match all riak stat entries. - - Example: - \$ riak admin stat show riak.riak_kv.node.gets - [riak,riak_kv,node,gets]: [{count,0},{one,0}] - - - 'Legacy name': The stat names used e.g. in \`$SCRIPT admin status\` can be used - here, but also with wildcard support. The corresponding Exometer name and - datapoint will be shown as well. - - Example: - \$ riak admin stat show node_gets - == node_gets (Legacy pattern): == - node_gets: 0 ([riak,riak_kv,node,gets]/one) - - (Note: A single '*' is treated as a legacy name and would match all such - names that contain no underscores; to match all exometer names, a '.' must - be present, so '*.**' would work as a catch-all expression.) - - Each Exometer entry has a type and a set of datapoints. A filter can be - given on the command line, selecting only a subset of datapoints: - - \$ riak admin stat show riak.riak_kv.node.gets/one - [riak,riak_kv,node,gets]: [{one,0}] - - The type can also be restricted: - \$ riak admin stat show *.**/type=duration/mean,max - [riak,riak_core,converge_delay]: [{mean,0},{max,0}] - [riak,riak_core,rebalance_delay]: [{mean,0},{max,0}] - - Note how multiple datapoints are separated by comma (no space). - - Showing disabled entries: - \$ riak admin stat show riak.riak_kv.node.gets - No matching stats - \$ riak admin stat show riak.riak_kv.node.gets/status=* - [riak,riak_kv,node,gets]: disabled - \$ riak admin stat show riak.riak_kv.node.gets/status=disabled - [riak,riak_kv,node,gets]: disabled -" -} - -stat_show_0_help() -{ - echo "\ - - Usage: $SCRIPT admin stat show-0 [/type=][/status=] - - Shows the Stats in riak, that are not updating or have a value of 0. - - See 'riak admin stat help show' for the formatting of the , - this works in the same way. - - Example: - - \$ riak admin stat show-0 riak.**/type=duration - [riak,riak_core,converge_delay]: [{mean,0},{max,0}] - [riak,riak_core,rebalance_delay]: [{mean,0},{max,0}] - - " -} - -stat_enable_help() -{ - echo "\ - - Exometer stats can be disabled and enabled, and this can be done - using \`$SCRIPT admin stat enable|disable \`. Disabled entries are not actively - updated, and have no value. - - The same syntax can be used as in \`stat show\`. The requested action will be - performed on the matching entries. - - \$ riak admin stat disable node_gets - == node_gets (Legacy pattern): == - [riak,riak_kv,node,gets]: disabled - \$ riak admin stat enable node_gets - == node_gets (Legacy pattern): == - [riak,riak_kv,node,gets]: enabled - - Wildcards can be used: - - \$ riak admin stat disable riak.riak_kv.node.* - [riak,riak_kv,node,gets]: disabled - [riak,riak_kv,node,puts]: disabled -" -} - -stat_disable_0_help() -{ - echo "\ - - Some stats in exometer might go unused, and will not update often if - at all. \`$SCRIPT admin stat disable-0\` disables all the stats in exometer - that are enabled and have not updated values at all. - - The same syntax can be used as in \`stat show\`. The requested action will be - performed on the matching entries, in the same way as \`stat disable\`. - - \$ riak admin stat disable-0 node_gets - == node_gets (Legacy pattern): == - [riak,riak_kv,node,gets]: disabled - - Wildcards can be used: - - \$ riak admin stat disable-0 riak.riak_kv.node.* - [riak,riak_kv,node,gets]: disabled - [riak,riak_kv,node,puts]: disabled -" -} - - -stat_info_help() -{ - echo "\ - - Usage: $SCRIPT admin stat info [- [-]] - - Display Exometer meta-data for matching entries. Type of data can be controlled - with options: - - info [ -name - | -type - | -module - | -value - | -cache - | -status - | -timestamp - | -options - | -ref - | -datapoints ] - - The same entry formats can be used as for all other stat subcommands. - - Example: - \$ riak admin stat info riak.riak_kv.node.gets - [riak,riak_kv,node,gets]:[{name,[riak,riak_kv,node,gets]}, - {type,spiral}, - {module,exometer_spiral}, - {value,disabled}, - {cache,0}, - {status,disabled}, - {timestamp,undefined}, - {options,[{status,disabled}]}] - - \$ riak admin stat info -type -status riak.riak_kv.node.gets - [riak,riak_kv,node,gets]:[{type,spiral}, - {status,disabled}] -" -} - -stat_reset_help() -{ - echo "\ - - Usage: $SCRIPT admin stat reset - - Reset matching stat entries. Only enabled entries can be reset. -" -} - -stat_metadata_help() -{ - echo "\ - - Usage $SCRIPT admin stat metadata = enable | disable | status - - Enable or Disable the persistence of stat options and configuration in - the metadata. Disabling would mean the status of the stat, i.e. whether - it is enabled or disabled would not be persisted, meaning on reboot the - stat will be enabled as default. - -" -} - -profile_help() -{ - echo "\ - - Usage: $SCRIPT admin profile [] - - Profiles are the specific set up of stats, whether - enabled, - disabled or unregistered, it is recorded in the profile upon saving, - loading a profile remains persisted after a reboot, saving it in - the metadata so the exact profile is available to all nodes in the cluster, - allowing consistency in testing and laziness in setting up. - - load Loads the status configuration of stats saved under this - profile - - save Saves the current configuration of stats and their status in - the metadata under - - delete Deletes the entry from the metadata, does not affect the stats - - reset Resets all the stats to enabled, unloads a profile that is loaded - -" -} - -profile_load_help() -{ - echo "\ - - Usage: $SCRIPT admin profile load - - Load all the stats in a \`profile\` that have a different status to the - one in exometer, and record \`profile\` as ''loaded'' in the metadata. upon reboot - the profile that was loaded on the node last will be ''reloaded''. - - Will load profile that has been saved on a different node, as it is gossiped round - to the rest of the cluster. - -" -} - -profile_save_help() -{ - echo "\ - - Usage: $SCRIPT admin profile save - - Takes the string given as the profile's name, saves the currnet configuration of - stats, i.e. their status - being enabled or disabled, their type and how many times - they have been reset (This option is also recorded in exometer but it is not persisted) - - If the profile name entered is the same as another profile in the metadata it will - be overwritten. - Best to load the profile first top check. If that profile name does - not exist, you're in the clear. - -" -} - -profile_delete_help() -{ - echo "\ - - Usage: $SCRIPT admin profile delete - - Deletes the Profile from the metadata for all nodes in the cluster. If the profile is - loaded on another node it will not effect it. If it is loaded on this node it will ''unload'' - it but not change any configuration of stats. - -" -} - -profile_reset_help() -{ - echo "\ - - Usage: $SCRIPT admin profile reset - - Remove the currently loaded profile, and re-enable the stats that were disabled by that profile. - The profile isn't deleted. - -" -} - -push_help() -{ - echo "\ - - Setup an endpoint with udp or tcp in order to poll the stats in exometer and send to an endpoint. - - setup [opts] similar to stat enable , setting up requires - the port number e.g. 8080, serverip == sip, and protocol - -> protocol=udp,port=8080,sip=127.0.0.1 for example - Use setup-port to change ports as well as restarting a port, - Specific stats can be chosen to be pushed, otherwise the - default will poll all stats in exometer. - - opts :: protocol= udp | tcp - port= - instance= - sip - - setdown can be same as above, closes the socket for that protocol - - info can also be the same as above, works in a similar - way to riak stat show, to find the information based - on protocol, instance or whether it is still running etc. - - info-all Used the same as above but will return information on all nodes" -} - -push_setup_help() -{ - echo "\ - - Usage: $SCRIPT admin push setup protocol=, - port=, - instance=, - sip= - [/stats=] - - Setup polling from node to endpoint; protocol, port, instance and serverip/hostname - must be given, stats are optional, default : riak.** (all stats in riak). - - :: tcp | udp (http not supported) - :: 0..65535 - :: Server instance - :: IP address / hostname - For the formatting on see \`riak admin stat help show\` for more details. - - Example: - \$ riak admin push setup protocol=tcp,port=9090,sip=127.0.0.1,instance=testingtcp - Polling Started - - " -} - -push_setdown_help() -{ - echo "\ - - Usage: $SCRIPT admin push setdown [protocol=] - [,port=] - [,instance=] - [,sip=] - - Setdown polling on the node; protocol, port, instance or serverip/hostname - must be given, as multiple instances of polling can be running it is better to - give the instance name if known to be specific to one process. - - :: tcp | udp (http not supported) - :: 0..65535 - :: Server instance - :: IP address / hostname - - Example: Stopping all tcp polling instances - \$ riak admin push setdown protocol=tcp - Polling Stopped for : [,...] - Example: Stopping all instances on local IP - \$ riak admin push setdown sip=127.0.0.1 - Polling Stopped for : [,...] - Example: Stopping Polling using instance name - \$ riak admin push setdown instance=testingtcp - Polling Stopped for: testingtcp - - " -} -push_info_help() -{ - echo "\ - - Usage: $SCRIPT admin push info [protocol=] - [,port=] - [,instance=] - [,sip=] - [/stats=] - - find all the instances of the options given, works in a similar way - to \`riak admin stat show\` and \`riak admin stat info\`. - - Protocol has to be entered. If the protocol does not matter then * can be used. - The other options are optional. The Dates and times of when the instance was - started is displayed as well as if it is still running. - - :: tcp | udp | * (http not supported) - :: 0..65535 - :: Server instance - :: IP address / hostname - For the formatting on see \`riak admin stat help show\` for more details. - - Example: finding tcp protocols - \$ riak admin push info protocol=tcp - Example: finding instances on port 8000 - \$ riak admin push info protocol=*,port=8000 - Example: finding instances on run locally for udp - \$ riak admin push info protocol=udp,sip=127.0.0.1 - - " -} - - cluster_admin() { case "$1" in @@ -1414,18 +806,6 @@ case "$1" in shift cluster_admin "$@" ;; - stat) - shift - stat_admin "$@" - ;; - profile) - shift - profile_admin "$@" - ;; - push) - shift - push_admin "$@" - ;; bucket-type) shift btype_admin "$@" diff --git a/rel/files/riak-stat b/rel/files/riak-stat new file mode 100644 index 000000000..a5ecb5ecd --- /dev/null +++ b/rel/files/riak-stat @@ -0,0 +1,670 @@ +#!/bin/sh +# -*- tab-width:4;indent-tabs-mode:nil -*- +# ex: ts=4 sw=4 et + +# Keep track of where script was invoked +ORIGINAL_DIR=$(pwd) + +# Make sure CWD is set to runner run dir +cd $RUNNER_BASE_DIR + +# Identify the script name +SCRIPT=`basename $0` + +usage() { + echo "Usage: $SCRIPT { show | show-0 | disable-0 | info | enable" + echo " disable | reset | metadata | help }" +} + +case "$1" in + profile) + shift + profile_admin "$@" + ;; + push) + shift + push_admin "$@" + ;; + help) + shift + help "$@" + ;; + *) + shift + stat_admin "$@" + ;; +esac + +profile_admin() +{ + if [ -n "$3" ]; then + case "$2" in + load) + shift + relx_nodetool rpc riak_stat_profiles load_profile "$*" + ;; + save) + shift + relx_nodetool rpc riak_stat_profiles save_profile "$*" + ;; + delete) + shift + relx_nodetool rpc riak_stat_profiles delete_profile "$*" + ;; + help) + case "$3" in + load) + profile_load_help + ;; + save) + profile_save_help + ;; + delete) + profile_delete_help + ;; + reset) + profile_reset_help + ;; + *) + profile_help + esac + ;; + *) + profile_help + esac + + elif [ -z "$3" ]; then + case "$2" in + help) + profile_help + ;; + reset) + shift + relx_nodetool rpc riak_stat_profiles reset_profile + ;; + *) + echo "No Argument Entered" + esac + fi +} + +profile_help() +{ + echo "\ + + Usage: $SCRIPT profile (load | save | delete | reset) + + Profiles are the specific set up of stats, whether enabled or disabled, + saved in the metadata to allow consistency in testing and laziness in + setting up. + + load Loads the stats configuration saved under + + save Takes the current configuration of stats and saves + under + + delete Deletes the from metadata, does not affect the + configuration of stats + + reset Reset the configuration of stats back to enabled, + unload any profile - does not affect the stats values. + + " +} + +profile_load_help() +{ + echo "\ + + Usage: $SCRIPT profile load + + Load all the stats in a \`profile\`, changing any stats with a different + cnofiguration to the one in the profile. + + A profile created on a different node in the cluster can be loaded on + another node. + + Any profile loaded before shutdown will be reloaded after reboot. + + Example: + \$ riak stat profile load test-profile + + " +} + +profile_save_help() +{ + echo "\ + + Usage: $SCRIPT profile save + + Save as the profile's name for the current configuration of stats, + if a profile of that name already exists then it will be overwritten. + + Example: + \$ riak stat profile save test-profile + + " +} + +profile_delete_help() +{ + echo "\ + + Usage: $SCRIPT profile delete + + Delete the profile from the metadata for all nodes in the cluster, it will + remove it's record from the metadata but not affect the stats and their + current status. + + Example: + \$ riak stat profile delete test-profile + + " +} + +profile_reset_help() +{ + echo "\ + + Usage: $SCRIPT profile reset + + Remove the profile current loaded (without deletion), re-enable all the + stats that are disabled in exometer + + Example: + \$ riak stat profile reset + + " +} + +push_admin() +{ + if [ -n "$3" ]; then + if [["$4" == @(tcp|udp) ]]; then + case "$2" in + setup) + shift + relx_nodetool rpc riak_stat_push setup "$@" + ;; + setdown) + shift + relx_nodetool rpc riak_stat_push setdown "$@" + ;; + info) + shift + relx_nodetool rpc riak_stat_push find_push_stats "$@" + ;; + info-all) + shift + relx_nodetool rpc riak_stat_push find_push_stats_all "$@" + ;; + help) + shift + case "$3" in + setup) + push_setup_help + ;; + setdown) + push_setdown_help + ;; + info) + push_info_help + ;; + info-all) + push_info_all_help + ;; + *) + push_help + esac + ;; + *) + push_help + esac + else + echo "Wrong Protocol Type" + fi + elif [ -z "$3" ]; then + case "$2" in + help) + push_help + ;; + *) + echo "No Argument Entered" + esac + fi +} + +push_help() +{ + echo "\ + + Usage: $SCRIPT push (setup | setdown | info | info-all) + :: : [] + + Control the polling of stats from exometer and the output to an endpoint + using UDP and TCP protocols. + + setup : [] + + setdown (specific) + | (all instances of that protocol) + | : [ []] + + info : [ []] + (return information about current and previous setups of + this nodes stat pushing) + + info-all : [ []] + (return information about current and previous setups of + all nodes in the cluster, for stat pushing) + + name without spaces + tcp | udp | * + serverip | hostname + 0...65535 + riak.. + (see riak admin stat help) + + " +} + +push_setup_help() +{ + echo "\ + + Usage: $SCRIPT push setup : [] + + Setup the polling of stats in exometer and pushing to an endpoint of + the hostname:port provided. + + ipaddr | hostname + 0...65535 + tcp | udp + name of instance (no spaces) + as riak admin stat show etc... + + If is not provided all the stats are polled by default (enabled ones) + + Example : + \$ riak stat push setup 127.0.0.1:8000 udp test-udp riak.riak_kv.node.** + + " +} + +push_setdown_help() +{ + echo "\ + + Usage: $SCRIPT push setdown [[[:] []] ] + + Stop the polling and pushing of stats to an endpoint, It is best to give the + instance of the setup specifically - as the instances are unique to each one. + Multiple instances can be shutdown at once if calling for a generic denominator + + For Example: + + \$ riak stat push setdown tcp + (will stop all tcp instances) + + \$ riak stat push setdown *:8080 udp + (stops udp instances going to 8080 port, of any host) + + " +} + +push_info_help() +{ + echo "\ + + Usage: $SCRIPT push info [[] []] ] + + Find all the instances with details given on this node. + Works in a smiilar way to \`riak stat push setdown __\`, information on + multiple instances can be returned if a generic denominator is called. + + For Example: + + \$ riak stat push info tcp + (will return information on all tcp instances + + \$ riak stat push info *:8080 udp + (will return information on udp instances that a pushing to + a port : 8080) + + \$ riak stat push info * + (will return information on everything + + " +} + +push_info_all_help() +{ + echo "\ + + Usage: $SCRIPT push info-all [[] []] ] + + works in the same way as \`riak stat push info ___\` except it returns + the information on instances for all the nodes. + + " +} + +stat_admin() +{ + if [ -n "$3" ]; then + case "$2" in + show) + shift + relx_nodetool rpc riak_stat_console show_stat "$*" + ;; + show-0) + shift + relx_nodetool rpc riak_stat_console show_stat_0 "$*" + ;; + disable-0) + shift + relx_nodetool rpc riak_stat_console disable_stat_0 "$*" + ;; + info) + shift + relx_nodetool rpc riak_stat_console stat_info "$*" + ;; + enable) + shift + relx_nodetool rpc riak_stat_console stat_enable "$*" + ;; + disable) + shift + relx_nodetool rpc riak_stat_console stat_disable "$*" + ;; + reset) + shift + relx_nodetool rpc riak_stat_console reset_stat "$*" + ;; + metadata) + if [["$3" == @(enable|disable|status) ]]; then + shift + relx_nodetool rpc riak_stat_console stat_metadata "$3" + else + echo "Wrong Argument Type entered" + fi + ;; + help) + shift + case "$3" in + show) + stat_show_help + ;; + show-0) + stat_show_0_help + ;; + enable) + stat_enable_help + ;; + disable) + stat_enable_help + ;; + disable-0) + stat_disable_0_help + ;; + info) + stat_info_help + ;; + reset) + stat_reset_help + ;; + metadata) + stat_metadata_help + ;; + *) + help + esac + ;; + *) + help + esac + + elif [ -z "$3" ]; then + case "$2" in + help) + help + ;; + *) + echo "No Argument Entered" + esac + fi +} + +help() +{ +echo "\ + + Usage: $SCRIPT stat + + The following commands display, enable/disable and reset stats. + A stats entry is given either as a 'dotted' exometer name - with + Identifiers separated by periods, '.', e.g. riak.riak_kv.node.gets, + or as a 'legacy' name (same as in riak-admin status) - e.g. node_gets. + When a legacy name is listed, the corresponding exometer name is shown as well. + + Two kinds of wildcard are suppored: + * - matches anything up to the next separator ('.' or '_') or end of name; + ** - matches anything including separators. + Quoting is permitted. + + Use \`$SCRIPT admin stat help \` for more details. + + show Show the value(s) of a specific entry or entries + show-0 Show the entry or entries that are not updating + disable-0 Disable the entry or entries that are not updating + enable Enable entry or entries + disable Disable entry or entries + reset Reset entry or entries + info [ -name | -type | Display information about the entry or entries. + | -module The attributes are described in the Exometer docs + | -value | -cache + | -status | -timestamp + | -options | -ref + | -datapoints ] + + Additional Functions : + + Enable the persistence of stats and their configuration, as well as house the profiles + functionality, gives more control over the use and status of all stats within riak + + metadata :: enable | disable + Enables or disables the use of metadata in riak_stat, disabling the + metadata will prevent the persistence of stats configuration + +" +} + +stat_show_help() +{ + echo "\ + + Usage: $SCRIPT stat show [/type=][/status=][/[,]] + + Show matching stats entries together with corresponding values + + The format of can be one of: + - 'Dotted exometer name': In Exometer, entries are represented as [A,B,...]. + These names can be emulated on the command-line as A.B.... Wildcards are + supported: '*' will match anything between deliminators (dots), whereas + '**' will match anything including deliminators. Thus \`stat show \"*.**\"\` + will match all stats entries. All Riak stat entry names start with 'riak', + so \`stat show riak.**\` will match all riak stat entries. + + Example: + \$ riak stat show riak.riak_kv.node.gets + [riak,riak_kv,node,gets]: [{count,0},{one,0}] + + - 'Legacy name': The stat names used e.g. in \`$SCRIPT admin status\` can be used + here, but also with wildcard support. The corresponding Exometer name and + datapoint will be shown as well. + + Example: + \$ riak stat show node_gets + == node_gets (Legacy pattern): == + node_gets: 0 ([riak,riak_kv,node,gets]/one) + + (Note: A single '*' is treated as a legacy name and would match all such + names that contain no underscores; to match all exometer names, a '.' must + be present, so '*.**' would work as a catch-all expression.) + + Each Exometer entry has a type and a set of datapoints. A filter can be + given on the command line, selecting only a subset of datapoints: + + \$ riak stat show riak.riak_kv.node.gets/one + [riak,riak_kv,node,gets]: [{one,0}] + + The type can also be restricted: + \$ riak stat show *.**/type=duration/mean,max + [riak,riak_core,converge_delay]: [{mean,0},{max,0}] + [riak,riak_core,rebalance_delay]: [{mean,0},{max,0}] + + Note how multiple datapoints are separated by comma (no space). + + Showing disabled entries: + \$ riak stat show riak.riak_kv.node.gets + No matching stats + \$ riak stat show riak.riak_kv.node.gets/status=* + [riak,riak_kv,node,gets]: disabled + \$ riak stat show riak.riak_kv.node.gets/status=disabled + [riak,riak_kv,node,gets]: disabled +" +} + +stat_show_0_help() +{ + echo "\ + + Usage: $SCRIPT stat show-0 [/type=][/status=] + + Shows the Stats in riak, that are not updating or have a value of 0. + + See 'riak stat help show' for the formatting of the , + this works in the same way. + + Example: + + \$ riak stat show-0 riak.**/type=duration + [riak,riak_core,converge_delay]: [{mean,0},{max,0}] + [riak,riak_core,rebalance_delay]: [{mean,0},{max,0}] + + " +} + +stat_enable_help() +{ + echo "\ + + Exometer stats can be disabled and enabled, and this can be done + using \`$SCRIPT stat enable|disable \`. Disabled entries are not actively + updated, and have no value. + + The same syntax can be used as in \`stat show\`. The requested action will be + performed on the matching entries. + + \$ riak stat disable node_gets + == node_gets (Legacy pattern): == + [riak,riak_kv,node,gets]: disabled + \$ riak stat enable node_gets + == node_gets (Legacy pattern): == + [riak,riak_kv,node,gets]: enabled + + Wildcards can be used: + + \$ riak stat disable riak.riak_kv.node.* + [riak,riak_kv,node,gets]: disabled + [riak,riak_kv,node,puts]: disabled +" +} + +stat_disable_0_help() +{ + echo "\ + + Some stats in exometer might go unused, and will not update often if + at all. \`$SCRIPT stat disable-0\` disables all the stats in exometer + that are enabled and have not updated values at all. + + The same syntax can be used as in \`stat show\`. The requested action will be + performed on the matching entries, in the same way as \`stat disable\`. + + \$ riak stat disable-0 node_gets + == node_gets (Legacy pattern): == + [riak,riak_kv,node,gets]: disabled + + Wildcards can be used: + + \$ riak stat disable-0 riak.riak_kv.node.* + [riak,riak_kv,node,gets]: disabled + [riak,riak_kv,node,puts]: disabled +" +} + + +stat_info_help() +{ + echo "\ + + Usage: $SCRIPT stat info [- [-]] + + Display Exometer meta-data for matching entries. Type of data can be controlled + with options: + + info [ -name + | -type + | -module + | -value + | -cache + | -status + | -timestamp + | -options + | -ref + | -datapoints ] + + The same entry formats can be used as for all other stat subcommands. + + Example: + \$ riak stat info riak.riak_kv.node.gets + [riak,riak_kv,node,gets]:[{name,[riak,riak_kv,node,gets]}, + {type,spiral}, + {module,exometer_spiral}, + {value,disabled}, + {cache,0}, + {status,disabled}, + {timestamp,undefined}, + {options,[{status,disabled}]}] + + \$ riak stat info -type -status riak.riak_kv.node.gets + [riak,riak_kv,node,gets]:[{type,spiral}, + {status,disabled}] +" +} + +stat_reset_help() +{ + echo "\ + + Usage: $SCRIPT stat reset + + Reset matching stat entries. Only enabled entries can be reset. +" +} + +stat_metadata_help() +{ + echo "\ + + Usage $SCRIPT stat metadata = enable | disable | status + + Enable or Disable the persistence of stat options and configuration in + the metadata. Disabling would mean the status of the stat, i.e. whether + it is enabled or disabled would not be persisted, meaning on reboot the + stat will be enabled as default. + +" +} \ No newline at end of file From e71e7e689609634bf4f43d483f3ec833d56b0853 Mon Sep 17 00:00:00 2001 From: banana Date: Fri, 17 Jan 2020 14:22:09 +0000 Subject: [PATCH 35/40] added riak-stat to the rebar.config overlay template --- rebar.config | 1 + 1 file changed, 1 insertion(+) diff --git a/rebar.config b/rebar.config index c3023278a..3a8e6827c 100644 --- a/rebar.config +++ b/rebar.config @@ -85,6 +85,7 @@ {template, "rel/files/riak-debug", "bin/riak-debug"}, {template, "rel/files/riak-chkconfig", "bin/riak-chkconfig"}, {template, "rel/files/riak-repl", "bin/riak-repl"}, + {template, "rel/files/riak-stat", "bin/riak-stat"}, {copy, "rel/files/check_ulimit", "bin/hooks/check_ulimit"}, {copy, "rel/files/riak_not_running", "bin/hooks/riak_not_running"} From 999c974eb8839de146369ceeeb123f6b85b00959 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 20 Jan 2020 13:52:42 +0000 Subject: [PATCH 36/40] riak-stat rel file --- rel/files/riak-stat | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/rel/files/riak-stat b/rel/files/riak-stat index a5ecb5ecd..6dc98b51d 100644 --- a/rel/files/riak-stat +++ b/rel/files/riak-stat @@ -18,27 +18,34 @@ usage() { case "$1" in profile) + echo "$1" + echo "$@" shift profile_admin "$@" ;; push) + echo "$1" + echo "$@" shift push_admin "$@" ;; help) + echo "$1" + echo "$@" shift help "$@" ;; *) + echo "$1" + echo "$@" shift stat_admin "$@" - ;; esac profile_admin() { - if [ -n "$3" ]; then - case "$2" in + if [ -n "$2" ]; then + case "$1" in load) shift relx_nodetool rpc riak_stat_profiles load_profile "$*" @@ -73,8 +80,8 @@ profile_admin() profile_help esac - elif [ -z "$3" ]; then - case "$2" in + elif [ -z "$2" ]; then + case "$1" in help) profile_help ;; @@ -180,9 +187,9 @@ profile_reset_help() push_admin() { - if [ -n "$3" ]; then - if [["$4" == @(tcp|udp) ]]; then - case "$2" in + if [ -n "$2" ]; then + if [["$3" == @(tcp|udp) ]]; then + case "$1" in setup) shift relx_nodetool rpc riak_stat_push setup "$@" @@ -201,7 +208,7 @@ push_admin() ;; help) shift - case "$3" in + case "$2" in setup) push_setup_help ;; @@ -224,8 +231,8 @@ push_admin() else echo "Wrong Protocol Type" fi - elif [ -z "$3" ]; then - case "$2" in + elif [ -z "$2" ]; then + case "$1" in help) push_help ;; @@ -352,8 +359,8 @@ push_info_all_help() stat_admin() { - if [ -n "$3" ]; then - case "$2" in + if [ -n "$2" ]; then + case "$1" in show) shift relx_nodetool rpc riak_stat_console show_stat "$*" @@ -383,16 +390,16 @@ stat_admin() relx_nodetool rpc riak_stat_console reset_stat "$*" ;; metadata) - if [["$3" == @(enable|disable|status) ]]; then + if [["$2" == @(enable|disable|status) ]]; then shift - relx_nodetool rpc riak_stat_console stat_metadata "$3" + relx_nodetool rpc riak_stat_console stat_metadata "$2" else echo "Wrong Argument Type entered" fi ;; help) shift - case "$3" in + case "$1" in show) stat_show_help ;; @@ -425,12 +432,13 @@ stat_admin() help esac - elif [ -z "$3" ]; then - case "$2" in + else + case "$1" in help) help ;; *) + usage echo "No Argument Entered" esac fi From be50e24001af812b618ce4e6ee19d103fe13772e Mon Sep 17 00:00:00 2001 From: banana Date: Mon, 20 Jan 2020 17:24:51 +0000 Subject: [PATCH 37/40] changes to push admin --- rel/files/riak-stat | 147 ++++++++++++++++++++++---------------------- 1 file changed, 72 insertions(+), 75 deletions(-) mode change 100644 => 100755 rel/files/riak-stat diff --git a/rel/files/riak-stat b/rel/files/riak-stat old mode 100644 new mode 100755 index 6dc98b51d..6f06824ce --- a/rel/files/riak-stat +++ b/rel/files/riak-stat @@ -16,32 +16,6 @@ usage() { echo " disable | reset | metadata | help }" } -case "$1" in - profile) - echo "$1" - echo "$@" - shift - profile_admin "$@" - ;; - push) - echo "$1" - echo "$@" - shift - push_admin "$@" - ;; - help) - echo "$1" - echo "$@" - shift - help "$@" - ;; - *) - echo "$1" - echo "$@" - shift - stat_admin "$@" -esac - profile_admin() { if [ -n "$2" ]; then @@ -59,7 +33,7 @@ profile_admin() relx_nodetool rpc riak_stat_profiles delete_profile "$*" ;; help) - case "$3" in + case "$2" in load) profile_load_help ;; @@ -188,49 +162,56 @@ profile_reset_help() push_admin() { if [ -n "$2" ]; then - if [["$3" == @(tcp|udp) ]]; then - case "$1" in - setup) - shift - relx_nodetool rpc riak_stat_push setup "$@" - ;; - setdown) - shift - relx_nodetool rpc riak_stat_push setdown "$@" - ;; - info) - shift - relx_nodetool rpc riak_stat_push find_push_stats "$@" - ;; - info-all) - shift - relx_nodetool rpc riak_stat_push find_push_stats_all "$@" - ;; - help) - shift - case "$2" in + case "$3" in + udp|tcp) + case "$1" in setup) - push_setup_help + if [ -n "$4" ]; then + shift + relx_nodetool rpc riak_stat_push setup "$@" + else + echo "No Instance Found" + fi ;; setdown) - push_setdown_help + shift + relx_nodetool rpc riak_stat_push setdown "$@" ;; info) - push_info_help + shift + relx_nodetool rpc riak_stat_push find_push_stats "$@" ;; info-all) - push_info_all_help - ;; - *) - push_help - esac - ;; - *) - push_help - esac - else - echo "Wrong Protocol Type" - fi + shift + relx_nodetool rpc riak_stat_push find_push_stats_all "$@" + esac + ;; + *) + case "$1" in + help) + case "$2" in + setup) + push_setup_help + ;; + setdown) + push_setdown_help + ;; + info) + push_info_help + ;; + info-all) + push_info_all_help + ;; + *) + push_help + esac + ;; + *) + push_help + esac + + esac + elif [ -z "$2" ]; then case "$1" in help) @@ -256,9 +237,9 @@ push_help() setdown (specific) | (all instances of that protocol) - | : [ []] + | [[:] []] []] - info : [ []] + info [[:] []] []] (return information about current and previous setups of this nodes stat pushing) @@ -390,16 +371,17 @@ stat_admin() relx_nodetool rpc riak_stat_console reset_stat "$*" ;; metadata) - if [["$2" == @(enable|disable|status) ]]; then - shift - relx_nodetool rpc riak_stat_console stat_metadata "$2" - else - echo "Wrong Argument Type entered" - fi + case "$2" in + enable|disable|status) + relx_nodetool rpc riak_stat_console stat_metadata "$2" + ;; + *) + echo "Wrong Argument Type entered" + stat_metadata_help + esac ;; help) - shift - case "$1" in + case "$2" in show) stat_show_help ;; @@ -439,11 +421,11 @@ stat_admin() ;; *) usage - echo "No Argument Entered" esac fi } + help() { echo "\ @@ -675,4 +657,19 @@ stat_metadata_help() stat will be enabled as default. " -} \ No newline at end of file +} + +case "$1" in + profile) + shift + profile_admin "$@" + ;; + push) + shift + push_admin "$@" + ;; + *) + stat_admin "$@" +esac + +exit 0 \ No newline at end of file From 6c2df153558dbe1e7f0f6253b5b0e1b29f2420d1 Mon Sep 17 00:00:00 2001 From: banana Date: Tue, 21 Jan 2020 13:21:21 +0000 Subject: [PATCH 38/40] Changed the push_admin to only have have to be udp|tcp for setup, update the help function outputs --- rel/files/riak-stat | 97 +++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 52 deletions(-) diff --git a/rel/files/riak-stat b/rel/files/riak-stat index 6f06824ce..2e66f7829 100755 --- a/rel/files/riak-stat +++ b/rel/files/riak-stat @@ -12,8 +12,8 @@ cd $RUNNER_BASE_DIR SCRIPT=`basename $0` usage() { - echo "Usage: $SCRIPT { show | show-0 | disable-0 | info | enable" - echo " disable | reset | metadata | help }" + echo "Usage: $SCRIPT stat { show | show-0 | disable-0 | info | enable" + echo " disable | reset | metadata | help | push | profile}" } profile_admin() @@ -64,7 +64,7 @@ profile_admin() relx_nodetool rpc riak_stat_profiles reset_profile ;; *) - echo "No Argument Entered" + profile_help esac fi } @@ -73,7 +73,7 @@ profile_help() { echo "\ - Usage: $SCRIPT profile (load | save | delete | reset) + Usage: $SCRIPT stat profile (load | save | delete | reset | help) Profiles are the specific set up of stats, whether enabled or disabled, saved in the metadata to allow consistency in testing and laziness in @@ -162,63 +162,56 @@ profile_reset_help() push_admin() { if [ -n "$2" ]; then - case "$3" in - udp|tcp) - case "$1" in - setup) - if [ -n "$4" ]; then - shift - relx_nodetool rpc riak_stat_push setup "$@" - else - echo "No Instance Found" - fi - ;; - setdown) - shift - relx_nodetool rpc riak_stat_push setdown "$@" - ;; - info) - shift - relx_nodetool rpc riak_stat_push find_push_stats "$@" - ;; - info-all) - shift - relx_nodetool rpc riak_stat_push find_push_stats_all "$@" - esac - ;; - *) - case "$1" in - help) - case "$2" in - setup) - push_setup_help - ;; - setdown) - push_setdown_help - ;; - info) - push_info_help - ;; - info-all) - push_info_all_help - ;; - *) - push_help - esac - ;; + case "$1" in + setup) + if [ -n "$4" ] && [[ "$3" == @(udp|tcp) ]]; then + shift + relx_nodetool rpc riak_stat_push setup "$@" + else + echo "No Instance name Entered or wrong Protocol type" + push_setup_help + fi + ;; + setdown) + shift + relx_nodetool rpc riak_stat_push setdown "$@" + ;; + info) + shift + relx_nodetool rpc riak_stat_push find_push_stats "$@" + ;; + info-all) + shift + relx_nodetool rpc riak_stat_push find_push_stats_all "$@" + ;; + help) + case "$2" in + setup) + push_setup_help + ;; + setdown) + push_setdown_help + ;; + info) + push_info_help + ;; + info-all) + push_info_all_help + ;; *) push_help esac - + ;; + *) + push_help esac - elif [ -z "$2" ]; then case "$1" in help) push_help ;; *) - echo "No Argument Entered" + echo "No Argument Entered" esac fi } @@ -252,7 +245,7 @@ push_help() serverip | hostname 0...65535 riak.. - (see riak admin stat help) + (see riak stat help) " } From 4934777bb48cce54dd6680b8d364376480b969db Mon Sep 17 00:00:00 2001 From: banana Date: Wed, 29 Jan 2020 13:21:20 +0000 Subject: [PATCH 39/40] removed show-0 and disable-0 --- rel/files/riak-stat | 64 ++------------------------------------------- 1 file changed, 2 insertions(+), 62 deletions(-) diff --git a/rel/files/riak-stat b/rel/files/riak-stat index 2e66f7829..a58cc3009 100755 --- a/rel/files/riak-stat +++ b/rel/files/riak-stat @@ -12,8 +12,8 @@ cd $RUNNER_BASE_DIR SCRIPT=`basename $0` usage() { - echo "Usage: $SCRIPT stat { show | show-0 | disable-0 | info | enable" - echo " disable | reset | metadata | help | push | profile}" + echo "Usage: $SCRIPT stat { show | info | enable | disable | reset" + echo " metadata | help | push | profile }" } profile_admin() @@ -339,14 +339,6 @@ stat_admin() shift relx_nodetool rpc riak_stat_console show_stat "$*" ;; - show-0) - shift - relx_nodetool rpc riak_stat_console show_stat_0 "$*" - ;; - disable-0) - shift - relx_nodetool rpc riak_stat_console disable_stat_0 "$*" - ;; info) shift relx_nodetool rpc riak_stat_console stat_info "$*" @@ -378,18 +370,12 @@ stat_admin() show) stat_show_help ;; - show-0) - stat_show_0_help - ;; enable) stat_enable_help ;; disable) stat_enable_help ;; - disable-0) - stat_disable_0_help - ;; info) stat_info_help ;; @@ -439,8 +425,6 @@ echo "\ Use \`$SCRIPT admin stat help \` for more details. show Show the value(s) of a specific entry or entries - show-0 Show the entry or entries that are not updating - disable-0 Disable the entry or entries that are not updating enable Enable entry or entries disable Disable entry or entries reset Reset entry or entries @@ -519,26 +503,6 @@ stat_show_help() " } -stat_show_0_help() -{ - echo "\ - - Usage: $SCRIPT stat show-0 [/type=][/status=] - - Shows the Stats in riak, that are not updating or have a value of 0. - - See 'riak stat help show' for the formatting of the , - this works in the same way. - - Example: - - \$ riak stat show-0 riak.**/type=duration - [riak,riak_core,converge_delay]: [{mean,0},{max,0}] - [riak,riak_core,rebalance_delay]: [{mean,0},{max,0}] - - " -} - stat_enable_help() { echo "\ @@ -565,30 +529,6 @@ stat_enable_help() " } -stat_disable_0_help() -{ - echo "\ - - Some stats in exometer might go unused, and will not update often if - at all. \`$SCRIPT stat disable-0\` disables all the stats in exometer - that are enabled and have not updated values at all. - - The same syntax can be used as in \`stat show\`. The requested action will be - performed on the matching entries, in the same way as \`stat disable\`. - - \$ riak stat disable-0 node_gets - == node_gets (Legacy pattern): == - [riak,riak_kv,node,gets]: disabled - - Wildcards can be used: - - \$ riak stat disable-0 riak.riak_kv.node.* - [riak,riak_kv,node,gets]: disabled - [riak,riak_kv,node,puts]: disabled -" -} - - stat_info_help() { echo "\ From ed3a380848ba873dbcd5e2628341d1162b9d1f5b Mon Sep 17 00:00:00 2001 From: banana Date: Tue, 3 Mar 2020 09:50:18 +0000 Subject: [PATCH 40/40] =?UTF-8?q?adding=20to=20keep=20backup=C2=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/riak/src/riak.app.src | 5 +- rebar.config | 4 +- rebar.lock | 176 +++++++++++++++++++++++++++++++++++++ rel/files/riak-stat | 38 ++++---- 4 files changed, 206 insertions(+), 17 deletions(-) create mode 100644 rebar.lock diff --git a/apps/riak/src/riak.app.src b/apps/riak/src/riak.app.src index cfe8b8a6c..51c6ab0c7 100644 --- a/apps/riak/src/riak.app.src +++ b/apps/riak/src/riak.app.src @@ -17,7 +17,10 @@ runtime_tools, lager_syslog, cluster_info, - riak_kv, + cluster_metadata, +%% exometer_core, + stats, + riak_kv, riak_repl, riak_auth_mods ]}, diff --git a/rebar.config b/rebar.config index e765ecc9c..1e4d836f8 100644 --- a/rebar.config +++ b/rebar.config @@ -61,6 +61,8 @@ basho_stats, bitcask, clique, + cluster_metadata, + stats, riak_core, riak_pipe, riak_kv, @@ -84,7 +86,7 @@ {template, "rel/files/riak-debug", "bin/riak-debug"}, {template, "rel/files/riak-chkconfig", "bin/riak-chkconfig"}, {template, "rel/files/riak-repl", "bin/riak-repl"}, - {template, "rel/files/riak-stat", "bin/riak-stat"}, + {template, "_checkouts/stats/rel/files/stats","bin/riak-stat"}, {copy, "rel/files/check_ulimit", "bin/hooks/check_ulimit"}, {copy, "rel/files/riak_not_running", "bin/hooks/riak_not_running"} diff --git a/rebar.lock b/rebar.lock new file mode 100644 index 000000000..6d5e12953 --- /dev/null +++ b/rebar.lock @@ -0,0 +1,176 @@ +{"1.1.0", +[{<<"basho_stats">>, + {git,"git://github.com/basho/basho_stats.git", + {ref,"176dee0537b5b3aff57646a7379d435ad990488e"}}, + 2}, + {<<"bear">>,{pkg,<<"bear">>,<<"0.8.7">>},4}, + {<<"bitcask">>, + {git,"git://github.com/basho/bitcask.git", + {ref,"1bb4c98d0285fe6caa76b89d51c50f4e504d2554"}}, + 1}, + {<<"canola">>, + {git,"git://github.com/basho/canola.git", + {ref,"2cd39378442f3dc727de22289243b3c4d56f25fd"}}, + 1}, + {<<"clique">>, + {git,"git://github.com/basho/clique.git", + {ref,"dc282124f4371f5d0bb8514aea9d033d98d83dd3"}}, + 2}, + {<<"cluster_info">>, + {git,"git://github.com/basho/cluster_info.git", + {ref,"18ed572102055626c1597339015d6501989df287"}}, + 0}, + {<<"cluster_metadata">>, + {git,"https://github.com/bet365/cluster_metadata.git", + {ref,"5c09cc24bc727f57c985c96cebe602bd61f0b56d"}}, + 2}, + {<<"cuttlefish">>, + {git,"https://github.com/basho/cuttlefish.git", + {ref,"1b4381e5f682d88a2f20ddb8511ff35098c40ea5"}}, + 3}, + {<<"dvvset">>, + {git,"git://github.com/ricardobcl/dotted-version-vectors.git", + {ref,"27fd1225c10a7dc4890e5e55abddf6db2392f6cc"}}, + 3}, + {<<"ebloom">>, + {git,"git://github.com/basho/ebloom.git", + {ref,"3c25f9ef61a73d5f1d2c2601da464dd03975721d"}}, + 1}, + {<<"eleveldb">>, + {git,"git://github.com/basho/eleveldb.git", + {ref,"5ca7491c947d24c764eb0a359370e83dcc0bb021"}}, + 2}, + {<<"eunit_formatters">>, + {git,"git://github.com/seancribbs/eunit_formatters", + {ref,"473e0cd89bf5608e97886a3bdf9047a16edc88f0"}}, + 1}, + {<<"folsom">>,{pkg,<<"folsom">>,<<"0.8.8">>},3}, + {<<"fuse">>, + {git,"https://github.com/jlouis/fuse.git", + {ref,"21c6e52ced3af294f2fe636039106068da12eeeb"}}, + 1}, + {<<"gen_fsm_compat">>,{pkg,<<"gen_fsm_compat">>,<<"0.3.0">>},1}, + {<<"getopt">>, + {git,"https://github.com/basho/getopt.git", + {ref,"880030ff0cbecb73ba75a78a7aa0cc1dcb7fe331"}}, + 4}, + {<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.9">>},2}, + {<<"hashtree">>, + {git,"git://github.com/martincox/hashtree.git", + {ref,"267974bc81e7bcb0287038cd9accc61d4079d108"}}, + 3}, + {<<"hut">>,{pkg,<<"hut">>,<<"1.3.0">>},3}, + {<<"hyper">>, + {git,"git://github.com/basho/hyper", + {ref,"d0bf3d67fd17b8ed2610b266aebd54b1027ea916"}}, + 1}, + {<<"ibrowse">>, + {git,"git://github.com/cmullaparthi/ibrowse.git", + {ref,"7529807170cf3c8f6a8c5c95526e670420ff591b"}}, + 1}, + {<<"kv_index_tictactree">>, + {git,"https://github.com/martinsumner/kv_index_tictactree.git", + {ref,"9c667cf656856877da9d9b84da120490d8196ae7"}}, + 1}, + {<<"kvc">>, + {git,"git://github.com/etrepum/kvc.git", + {ref,"5565fe51857747662410cc3c06362ebcf48a2f04"}}, + 1}, + {<<"lager">>, + {git,"git://github.com/erlang-lager/lager.git", + {ref,"22e62f28e5afabe90a6f31bcde367a2b5799fc94"}}, + 1}, + {<<"lager_syslog">>, + {git,"git://github.com/basho/lager_syslog.git", + {ref,"5c90466b25e5947020b09547e38439167e88363c"}}, + 0}, + {<<"leveled">>, + {git,"https://github.com/martinsumner/leveled.git", + {ref,"4d550ef2a1a2b7ff6f6dd2dc28e3b1aed44cf21d"}}, + 1}, + {<<"lz4">>, + {git,"https://github.com/szktty/erlang-lz4", + {ref,"6bc5efe93bab327788bcde24374f16044b549dd8"}}, + 2}, + {<<"mochiweb">>, + {git,"git://github.com/martinsumner/mochiweb.git", + {ref,"1c1d621632ce924b82bc733697d4115af91fc30f"}}, + 2}, + {<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.0">>},3}, + {<<"pbkdf2">>, + {git,"git://github.com/basho/erlang-pbkdf2.git", + {ref,"34b5f716fa3ec89ede36d009f7cc8c47bd019dd7"}}, + 2}, + {<<"poolboy">>, + {git,"https://github.com/Kyorai/poolboy.git", + {ref,"58ae8431dcf9cc69045d618417e5e6e74c7e8dde"}}, + 2}, + {<<"ranch">>, + {git,"git://github.com/ninenines/ranch.git", + {ref,"d0fad24657711cf584da61b5163c29fdafbd9201"}}, + 1}, + {<<"recon">>, + {git,"https://github.com/ferd/recon", + {ref,"75d70c7c08926d2f24f1ee6de14ee50fe8a52763"}}, + 1}, + {<<"redbug">>, + {git,"https://github.com/massemanet/redbug", + {ref,"c583d4567d1e2b8a540593ad0512559798d42565"}}, + 1}, + {<<"riak_auth_mods">>, + {git,"git://github.com/basho/riak_auth_mods.git", + {ref,"a991fd05929237413a641b60fc826412f98e099e"}}, + 0}, + {<<"riak_dt">>, + {git,"git://github.com/basho/riak_dt.git", + {ref,"cdf8cbf3009b7ecb4d659c1576a466cbefe47f55"}}, + 1}, + {<<"riak_ensemble">>, + {git,"https://github.com/basho/riak_ensemble", + {ref,"495833f7a79bb43e288a2a36c9acddfd27e8d90f"}}, + 2}, + {<<"riak_pb">>, + {git,"git://github.com/basho/riak_pb.git", + {ref,"55fab3a2642edf2293228d5a43748a0fc3c8e554"}}, + 1}, + {<<"riak_repl_pb_api">>, + {git,"git://github.com/basho/riak_repl_pb_api.git", + {ref,"6c9ce4abd1170ea77c2267addc18e0c5ad72bb1e"}}, + 1}, + {<<"riak_sysmon">>,{pkg,<<"riak_sysmon">>,<<"2.1.7">>},2}, + {<<"riakc">>, + {git,"git://github.com/basho/riak-erlang-client", + {ref,"302974b5e442ba6f01a89f81e6b393809200e5e4"}}, + 1}, + {<<"setup">>,{pkg,<<"setup">>,<<"2.0.2">>},3}, + {<<"sext">>, + {git,"git://github.com/uwiger/sext.git", + {ref,"615eebcf975ec4b4561c6f2b2bc433dabdb2be0f"}}, + 1}, + {<<"sidejob">>, + {git,"git://github.com/basho/sidejob.git", + {ref,"07dedd9b2043c9c6fd03b78fe8699f0f37418743"}}, + 1}, + {<<"syslog">>, + {git,"git://github.com/Vagabond/erlang-syslog", + {ref,"4a6c6f2c996483e86c1320e9553f91d337bcb6aa"}}, + 1}, + {<<"webmachine">>, + {git,"git://github.com/webmachine/webmachine.git", + {ref,"92225b82fc702f78cf9d23248023ec841272df80"}}, + 2}, + {<<"yokozuna">>, + {git,"git://github.com/basho/yokozuna.git", + {ref,"02d09d260f74eaa3c86256e822633509dcdfc1ee"}}, + 0}]}. +[ +{pkg_hash,[ + {<<"bear">>, <<"16264309AE5D005D03718A5C82641FCC259C9E8F09ADEB6FD79CA4271168656F">>}, + {<<"folsom">>, <<"9A2B02010F6727CB1948EF34E21CB66F3554B63355C3A31E8BCB10FB172C3170">>}, + {<<"gen_fsm_compat">>, <<"5903549F67D595F58A7101154CBE0FDD46955FBFBE40813F1E53C23A970FF5F4">>}, + {<<"goldrush">>, <<"F06E5D5F1277DA5C413E84D5A2924174182FB108DABB39D5EC548B27424CD106">>}, + {<<"hut">>, <<"71F2F054E657C03F959CF1ACC43F436EA87580696528CA2A55C8AFB1B06C85E7">>}, + {<<"parse_trans">>, <<"09765507A3C7590A784615CFD421D101AEC25098D50B89D7AA1D66646BC571C1">>}, + {<<"riak_sysmon">>, <<"AF420DF0F7569E1F12BCD465745164CB6189EB93F118D5CDB3F90FEB3F8BF47D">>}, + {<<"setup">>, <<"1203F4CDA11306C2E34434244576DED0A7BBFB0908D9A572356C809BD0CDF085">>}]} +]. diff --git a/rel/files/riak-stat b/rel/files/riak-stat index a58cc3009..48283a4fd 100755 --- a/rel/files/riak-stat +++ b/rel/files/riak-stat @@ -22,21 +22,28 @@ profile_admin() case "$1" in load) shift - relx_nodetool rpc riak_stat_profiles load_profile "$*" + relx_nodetool rpc riak_core_stat_persist load_profile "$*" + ;; + load-all) + shift + relx_nodetool rpc riak_core_stat_persist load_profile_all "$*" ;; save) shift - relx_nodetool rpc riak_stat_profiles save_profile "$*" + relx_nodetool rpc riak_core_stat_persist save_profile "$*" ;; delete) shift - relx_nodetool rpc riak_stat_profiles delete_profile "$*" + relx_nodetool rpc riak_core_stat_persist delete_profile "$*" ;; help) case "$2" in load) profile_load_help ;; + load-all) + profile_load_help + ;; save) profile_save_help ;; @@ -61,7 +68,7 @@ profile_admin() ;; reset) shift - relx_nodetool rpc riak_stat_profiles reset_profile + relx_nodetool rpc riak_core_stat_persist reset_profile ;; *) profile_help @@ -98,12 +105,13 @@ profile_load_help() echo "\ Usage: $SCRIPT profile load + $SCRPIT profile load-all Load all the stats in a \`profile\`, changing any stats with a different cnofiguration to the one in the profile. A profile created on a different node in the cluster can be loaded on - another node. + another node or all nodes at once. Any profile loaded before shutdown will be reloaded after reboot. @@ -166,7 +174,7 @@ push_admin() setup) if [ -n "$4" ] && [[ "$3" == @(udp|tcp) ]]; then shift - relx_nodetool rpc riak_stat_push setup "$@" + relx_nodetool rpc riak_core_console setup "$@" else echo "No Instance name Entered or wrong Protocol type" push_setup_help @@ -174,15 +182,15 @@ push_admin() ;; setdown) shift - relx_nodetool rpc riak_stat_push setdown "$@" + relx_nodetool rpc riak_core_console setdown "$@" ;; info) shift - relx_nodetool rpc riak_stat_push find_push_stats "$@" + relx_nodetool rpc riak_core_console find_push_stats "$@" ;; info-all) shift - relx_nodetool rpc riak_stat_push find_push_stats_all "$@" + relx_nodetool rpc riak_core_console find_push_stats_all "$@" ;; help) case "$2" in @@ -337,28 +345,28 @@ stat_admin() case "$1" in show) shift - relx_nodetool rpc riak_stat_console show_stat "$*" + relx_nodetool rpc riak_core_console show_stat "$*" ;; info) shift - relx_nodetool rpc riak_stat_console stat_info "$*" + relx_nodetool rpc riak_core_console stat_info "$*" ;; enable) shift - relx_nodetool rpc riak_stat_console stat_enable "$*" + relx_nodetool rpc riak_core_console stat_enable "$*" ;; disable) shift - relx_nodetool rpc riak_stat_console stat_disable "$*" + relx_nodetool rpc riak_core_console stat_disable "$*" ;; reset) shift - relx_nodetool rpc riak_stat_console reset_stat "$*" + relx_nodetool rpc riak_core_console reset_stat "$*" ;; metadata) case "$2" in enable|disable|status) - relx_nodetool rpc riak_stat_console stat_metadata "$2" + relx_nodetool rpc riak_core_console stat_metadata "$2" ;; *) echo "Wrong Argument Type entered"