Skip to main content

Posts

Reliability and Availability Metrics and Calculations

For a complex software solution, you usually have to stick to customer requirements for reliability and availability as defined in the SLA. For a monolithic appliance, this could be trivially determined, but most real world applications requires multiple physical nodes, VM or machine. Extrapolating the reliability and availability figures for a complex multi-tier software system could pose a challenge to an IT practitioner who is not familiar with reliability engineering. So, let's dine right into it. Let's first define some key terms, MTTF: Mean Time To Failure aka 'Average time betwwen two failure of a non-reparable component'. MTBF: Mean Time Between Failure aka 'Average time between two failures of a reparable component'. MTTR: Mean Time To Repair aka 'Average time to repair a component'. Now, let's estabish the concept of failure rate (λ) as , $\lambda = \frac{1}{MTBF}$ or $    = \frac{1}{MTTF}$ The reliability function is defined as,  $R(t) =
Recent posts

Reset root password RHEL/Rocky/CentOS 9

Unlike the earlier versions of Rethat variants, version 9 doesn't allow single user mode to change password, as maintanance mode in 9 requires root password . Single user mode (runlevel 1) can easily be obtained by appending the word ' single ' at the end of the line starting with 'linux' by editing the entry in boot menu by pressing ' e ' at boot menu. To reset the root password on the other hand, one requires to follow a specific set of commands, At the boot menu, edit rescue mode to append 'rd.break ' at the end of the line starting with kernel. Boot with the edited line by pressing Ctrl+X or F10. At the new prompt starting with switch_root, type the following commands, mount -o remount, rw /sysroot chroot /sysroot touch /.autorelabel passwd <new root password> exit reboot       

Updating OSM data in PostgreSQL snapshot schema from latest pbf

Getting pbf files from Geofabrik and uploading them into your own datastore has been discussed in this blog earlier. In this blog, we are gonna see how to update the data, as OSM data changes every day by millions of controbutors worldwide.  It is important to preseve the most recent pbf file in your hard drive, as we'll see in further. The steps to be followed are the following, Download the latest pbf file as per your business requirement. Generate the changes between the last pbf and the earlier version. Apply the change to your PostgreSQL data store. Let's follow this with a concrete example,  Assuming the last pbf we have applied is, india-20220122.osm.pbf dated Jan, 22, 2022. Download the most recent india osm pbf file, india-latest.osm.pbf Generate the change-log in xml format, osmosis-0.48.0/bin/osmosis --read-pbf file="india-latest.osm.pbf" --read-pbf file="india-20220122.osm.pbf" --derive-change --write-xml-change file=inddiff.osc Aplpy the changes

Opensteetmap Data Models

Opensteetmap is the crowdsourced mapping of the planet and can be accessed at https://opensteetmap.org The map data is freely downloadable and can be hosted locally for any purpose whatsoever under GPL license. Map data is downloadable in multiple archive formats like pbf  (Protocolbuffer Binary Format) and others. OSM's internal data model is represented as shown in the ER diagram above, but when it's imported from the PBF, it has to be efficient, fast and easy to use. Primarily, OSM databases can either be, Snapshot or  Historical Snapshot databases don't contain historical infromation (for instance, how a river changed it's course of the years or how landuse of a forested land changed over the year) whereas, Historical database contains this information. Naturally, historical databases are much more complex and requires more effort. Various parameters on how to judge various data stores are, Updatability Transactibility Concurrent Read/Writability Snapshot/Historical

GoF Design Patterns

Design Patterns listed out in GoF  Creational Pattern Abstract Factory Builder Factory Method Prototype Singleton Structural Pattern Adaptor Bridge Composite Decorator Facade Flyweight Proxy Behavioral Pattern Chain of Resposibility Command Interpreter Iterator Mediator Momento Observer State Strategy Template Method Visitor

Secugen Hamster Fingerprint reader API cannot function without the device

For those who are familiar with Secugen Devices, might know that there are two function calls to initialize the device API.   The Init(long devName) and  The InitEx(long width, long height, long dpi) As per the official Javadoc, the first one is meant to " Initialize the SecuGen libraries using attached SecuGen fingerprint sensor. This method should be called after Open() is called."  while the second one is for " Initializes the SecuGen libraries using image parameters. Only 8bits per pixel raw images are supported."  For the same function, the C++ documentation says , "Use when running fingerprint algorithm module without a SecuGen reader." I had a use case wherein, I want to do the fingerprint verification/matching at server-side. This made me wonder if I can use the second initialization function at the server end without the device and use the fingerprint matching APIs. I tried using the aforementioned approach, but the InitEx() method was failing

PostgreSQL with SSL auth (Java client)

PostgreSQL Server 1. Generate certificates Download easyrsa2 from github and extract it   # ./easyrsa build-ca # ./easyrsa build-server-full postgresql-server # ./easyrsa build-client-full postgresql-client   This will generate ca.crt in pki folder, postgres-server.crt , postgres-client.crt in pki/issued folder and postgres-server.key and postgres-client.key in pki/private folder.   PostgreSQL JDBC library cannot read .key file, which is why we have to convert the key to DER format (.pk8) file.   openssl pkcs8 -topk8 -outform DER -in postgres-client.key -out postgres-client.key.pk8 -nocrypt    Give proper unix permissions to the certificates and keys, for eg.   # chown postgres:postgres postgres-server.key  # chown postgres:postgres postgres-server.crt # chmod go-r postgres-server.key     2. Edit postgresql.conf ssl = on          ssl_cert_file = '/opt/postgres-sec/postgres-server.crt'    ssl_key_file = '/opt/postgres-sec/postgres-server.nopass.key' ssl_ca_file