recover / reset lost posgres password

I am a long time MySQL user, so Postgres administration is unfamiliar to me.  I did used Postgres a long time ago… when I first started my web hosting company, but back then (early 90’s), Postgres was young and not suited for our needs.  Discovered MySQL and never looked back.

Yeah, yeah, stop with the religious war already.  I believe that using the right tool for the job is more important than anything else.

Back to the problem at hand.  As a new, incoming admin, there is a lot of things I have to pick up on-the-fly.  There is a lot of historical knowledge that I do not have at new place.  Such as Postgres, which *work* uses and now I have to admin.  It seem that no one know the postgres user password, or don’t want to share ;->

I really don’t care for politics, just want to do my work!  So things break and I need access to system tables to fix it.  Can’t login to Postgres as postgres, yes, I have root and can su postgres, but still can not login via psql.

E.g. psql -h localhost -U postgress -d template1  ask me for password and I don’t know postgres user password

Searching (googling) found a lot of people asking for help, etc. but no specific way to solve the problem.  At least for a newbie Postgres admin like me.

Finally, someone pointed to pg_hba.conf…. reading the manual, backward, forward, sideways, etc…. and finally, finally, figured it out!

Here it is to save time for others.

Edit pg_hba.conf (usually in /var/lib/psql/data directory, at least on RH/CentOS/Fedora).

Add this line at top, first ACL match wins, so don’t worry about the rest there.

host all postgres trust

Then at command line, run pg_ctl reload

Now you can psql -h localhost -d template1 -U postgres and login without password.  Change the password to something you know.

alter user postgres with encrypted password ‘newpassword’;

Exit and comment out the line you added to pg_hba.conf, then reload config via

pg_ctl reload

Tada!  All fixed.

Monitoring Java programs

It’s harder than it look, or perhaps I am just making it harder than it really is.  Anyway, I have needs to monitory performance of java based applications.

There are actually two types (to me) of Java apps.  There is the standalone apps that you run on your workstation (Eclipse, I count embedded web applets in this category), and then there is the server based types such as Tomcat/JSP/J2EE/etc.

The category that I am most interested in is the server based apps.  I need to be able to look inside the JVM they are running in, and also the container (Tomcat/J2EE/etc.).  I am not an expert in this area, so at the moment, it’s a blackbox to me.

I’ve been searching around (yes, started with Googling :-)) and found lots of information all over the place.  I am going to try to gather them into one spot for my benefits, and hopefully save others some time.  As always, if you have corrections, additions, please feel free to send them to me.

List of Java performance monitoring tools.

  • this came from here
    1. jconsole comes with JDK 1.5 and above. It is a Java Monitoring and Management Console – JMX-compliant graphical tool for monitoring a Java virtual machine. It can monitor both local and remote JVMs.
    2. VisualVM is a visual tool that integrates several existing JDK software tools and lightweight memory and CPU profiling capabilities. This tool is designed for both production and development time use and further enhances the capability of monitoring and performance analysis for the Java SE platform.
    3. HeapAnalyzer allows the finding of a possible Java™ heap leak area through its heuristic search engine and analysis of the JavaTM heap dump in Java applications. It analyzes Java heap dumps by parsing the Java heap dump, creating directional graphs, transforming them into directional trees, and executing the heuristic search engine.
    4. PerfAnal is a GUI-based tool for analyzing the performance of applications on the Java 2 Platform. You can use PerfAnal to identify performance problems in your code and locate code that needs tuning.
    5. JAMon is a free, simple, high performance, thread safe, Java API that allows developers to easily monitor production applications.
    6. Eclipse Memory Analyzer is a fast and feature-rich Java heap analyzer that helps you find memory leaks and reduce memory consumption.
    7. GCViewer is a free open source tool to visualize data produced by the Java VM options -verbose:gc and -Xloggc:<file>. It also calculates garbage collection related performance metrics (throughput, accumulated pauses, longest pause, etc.).
    8. HPjmeter
      • Identify and diagnose performance problems in Java™ applications running on HP-UX
      • Monitor live Java™ applications and analyze profiling data
      • Capture profiling data with zero preparation when using JDK/JRE 5.0.04 or higher
      • Run the HPjmeter console on HP-UX, Linux, and Windows® systems
      • Improve garbage collection performance
    9. HPjconfig is a Java configuration tool for tuning your HP-UX 11i HP Integrity Itanium® and HP 9000 PA-RISC system kernel parameters to match the characteristics of your application. HPjconfig provides kernel parameter recommendations tailored to your HP-UX hardware platform. It offers save and restore functions for easy distribution of tailored recommendations across your customer base. When given specific Java and HP-UX versions, HPjconfig will determine if all of the latest HP-UX patches required for Java performance and functionality are installed on the system, and highlight any missing or superseded patches.
    10. Java Out-of-Box Tool is a stand-alone bundle that upon installation will install startup (RC) scripts, modify kernel parameters, rebuild the kernel, and reboot the system. During startup, the startup scripts will modify system tunables, thus providing better “Out of The Box” behavior for Java.
  • eclipse TPTP and Netbeans Profiler
  • YourKit
  • JProfiler
  • JIP
  • crap4j
  • JRockit

12/12/09 Updates

Yes, I will also consider commercial tools.  It’s been a few years since I develop Java full time.  My focus these days are on the Operation side – Network/System Administration, architectures, day to day operations.

SOHO NAS hacking paradise

I stumbled onto the Intel SS4200, which is intended as a SOHO platform for NAS.  Essentially it’s a small form factor PC, based on 1.6Ghz Celeron, 4 hot swap SATA drives, to be use as a home office NAS.

Turn out lots of other companies OEM this box (Fujitsu Siemens Scaleo is one).

Based on cursory Google search, there is a lot of people hacking this box.  It is very hackable, hw and sw wise.  One can add more memory (alas, only one slot, but you can go from 512KB to 2GB stick), upgrade the CPU (from Celeron to Core 2 Duo), etc.

Some useful links:

Update 01/14/10

Not that I have a lot of time, but I could not resist.  Company on eBay is selling a new SS4200-E for $135 (no drive, but 1GB RAM).  I’ve ordered one, and will start hacking once I have it.

Update 11/25/14

CPU can be upgraded from Celeron single core @1.6GHZ to Intel Core2Duo E4700 dual core @2.6GHZ

VUDU partnered with Entone

VUDU Goes Box-free for Entone
LA Time – VUDU and Entone team up…

Heh, that mean they (both of ’em) are still alive. That’s because they are doing something to stay above the tide of competition.

I’ve always thought that VUDU can’t survive on their own.  They need to partner with someone else, but it has to be the right partner, otherwise it’s a waste of resources (time, effort, fund…).  They had a couple of chances with some very good possibilities, but they screwed up.  Actually, IMHO, both sides screwed up….

Anyway, this is a step in the right direction, although I wish VUDU has partnered with one of the big players in the video on demand or consumer electronics field — e.g. Amazon, Samsung, LG, Sony, etc.

I think Samsung or Sony would be perfect partners for VUDU.  It’s a win-win for both side.