-
pg_dump is a nifty utility designed to output a series of SQL statements that describes the schema and data of your database. You can control what goes into your backup by using additional flags.
Backup:pg_dump -h localhost -p 5432 -U postgres -d mydb > backup.sqlRestore:
psql -h localhost -p 5432 -U postgres -d mydb < backup.sql-h is for host.
-p is for port.
-U is for username.
-d is for database.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env escript | |
| % -*- mode: erlang -*- | |
| main([BeamFile]) -> | |
| {ok,{_,[{abstract_code,{_,AC}}]}} = beam_lib:chunks(BeamFile,[abstract_code]), | |
| io:fwrite("~s~n", [erl_prettypr:format(erl_syntax:form_list(AC))]). |
- Starting: https://github.com/basho/riak_kv/blob/1.4.2/src/riak_kv_wm_object.erl#L619
- We create a new
riak_objectand populate the various fields with the headers, metadata supplied by the client. - Big suprise, we eventually call
riak_client:put: https://github.com/basho/riak_kv/blob/1.4.2/src/riak_client.erl#L143 - If/when the client returns any errors these are handled in
handle_common_errorsand it is nice to return human readable errors to client :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl -XPOST http://localhost:8098/mapred | |
| -H"Content-Type: application/json" | |
| -d '{"inputs":"notifications","query":[{"map":{"language":"erlang","source":"fun(O,_,_) when element(1,O) == r_object -> S=byte_size(term_to_binary(riak_object:get_values(O))), if (S>1048576) -> {ok,C}=riak:local_client(),C:delete(riak_object:bucket(O),riak_object:key(O)),[riak_object:key(O)]; true -> [] end;(_,_,_) -> [] end."}}]}' |