MySQL useConfigs=maxPerformance

I noticed this while updating to SonarQube 4.5. The documentation and references to this parameter lead me to believe that it is a useful shortcut to optimizing server resources.

In /opt/sonar/sonar.properties


sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance

NOTE: In some instances you may need to escape the ampersands!

I’ll change this on a few projects and watch for any issues changes.

REFERENCES:

Install Splunk Universal Forwarder on Ubuntu

After a while it can get tedious to access and review server logs via the command line. There are several tools available that can provide the same information in a graphical manner. Recently I’ve migrated to Splunk as there are both Enterprise and Free versions available.

  1. Of course, you’ll need a Splunk server installed first, as the forwarder is really just another (lighter) instance that will forward the log information to a central location.
  2. Download the system appropriate installer from:
    http://www.splunk.com/download/universalforwarder
  3. Check to see if you are running 32 or 64 bit OS.uname -aIf you see i686 you are 32 bit, if x86_64 you are 64 bit!
  4. Download, you’ll likely need a different version:sudo dpkg -i splunkforwarder-6.1.3-220630-linux-2.6-intel.deb
    or
    sudo dpkg -i splunkforwarder-6.1.3-220630-linux-2.6-amd64.deb
  5. Enable auto-start on reboot:cd /opt/splunkforwarder/bin/

sudo ./splunk enable boot-start

    1. Start the server:sudo service splunk start
    2. Set the password:

      The default ‘admin‘ password is ‘changeme‘ so we need to change it immediately to do anything else, or we will see errors in future steps.

      sudo /opt/splunkforwarder/bin/splunk edit user admin -password YOUR_NEW_PASSWORD -auth admin:changeme

    3. Set the server:sudo /opt/splunkforwarder/bin/splunk add forward-server YOUR_SERVER_ADDRESS:9997

      NOTE: if you get prompted for a splunk username/password you likely skipped the above step. Remember – the forwarder is a new ‘light’ installation of the server and as such has it’s own users!

    4. Enable some monitors on the box:Some common services and log locations to get you started…
      Apache2 HTTPd
      sudo /opt/splunkforwarder/bin/splunk add monitor /var/log/apache2 -index main -sourcetype Apache2
      Tomcat7
      sudo /opt/splunkforwarder/bin/splunk add monitor /opt/tomcat7/logs -index main -sourcetype Tomcat7
      MySQL
      sudo /opt/splunkforwarder/bin/splunk add monitor /var/log/mysql -index main -sourcetype MySQL
      Postfix (SMTP)
      sudo /opt/splunkforwarder/bin/splunk add monitor /var/log/mail.log -index main -sourcetype Postfix
      Squid3 (Proxy)
      sudo /opt/splunkforwarder/bin/splunk add monitor /var/log/squid/access.log -index main -sourcetype Squid3
      sudo /opt/splunkforwarder/bin/splunk add monitor /var/log/squid/cache.log -index main -sourcetype Squid3

      SonarQube
      sudo /opt/splunkforwarder/bin/splunk add monitor /opt/sonar/logs -index main -sourcetype Sonar
      PM2
      sudo /opt/splunkforwarder/bin/splunk add monitor /home/{user}/.pm2/logs -index main -sourcetype PM2
      NPM
      sudo /opt/splunkforwarder/bin/splunk add monitor /home/scott/.npm/_logs -index main -sourcetype NPM
  1. (OPTIONAL) Verify configuration by opening file at the following:sudo su
    vi /opt/splunkforwarder/etc/apps/search/local/inputs.conf
    exit
  2. You now should be able to log into your server and see new data flowing from the forwarder.

    NOTE: this requires you to enable ‘receiving’ of data on the port specified above, usually 9997.

REFERENCES:

Install SonarQube for Continous Inspection

Installation of Sonar requires but a few simple steps, though they can be rather obscure to many developers.

Connect to MySQL:

  1. CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;
  2. grant all privileges on sonar.* to 'sonar@localhost' identified by 'sonar';
  3. flush privileges;

Easiest method, if you are on Ubuntu:

  1. sudo vi /etc/apt/sources.list
  2. Then add the following line:
    deb http://downloads.sourceforge.net/project/sonar-pkg/deb binary/
  3. sudo apt-get update
  4. sudo apt-get install sonar
  5. You will then have to stop/start as above to edit the configuration, generally to change database config:
    sudo vi /opt/sonar/conf/sonar.properties

Manual installation (and upgrade?) if you prefer to do things the hard way 🙂

  1. Download and unzip the release:
    wget http://dist.sonar.codehaus.org/sonar-3.6.1.zip
    unzip sonar-3.6.1.zip
    sudo mv sonar-3.6.1 /opt/sonar
    sudo rm -r /opt/sonar (to remove old link)
    sudo ln -s /opt/sonar-3.6.1/ /opt/sonar
  2. cd /opt/sonar/conf
  3. vi sonar.properties
    (uncomment lines for MySQL, comment out H2)
  4. sudo cp /opt/sonar/bin/linux-x86-64/sonar.sh /etc/init.d/sonar
  5. sudo vi /etc/init.d/sonar
    add the following 2 lines:
    SONAR_HOME=/opt/sonar
    PLATFORM=linux-x86-64

    change:
    WRAPPER_CMD="${SONAR_HOME}/bin/${PLATFORM}/wrapper"
    WRAPPER_CONF="${SONAR_HOME}/conf/wrapper.conf"
    PIDDIR="/var/run"

  6. sudo update-rc.d -f sonar remove
  7. sudo chmod 755 /etc/init.d/sonar
  8. sudo update-rc.d sonar defaults
  9. /etc/init.d/sonar start

REFERENCES:

Upgrades can be a little odd, if you see the maintenance page at http://localhost:9000/maintenance, go to http://localhost:9000/setup and do the required steps.

REFERENCES:

Install MySQL database on Ubuntu and add new user.

Installing MySQL on Ubuntu requires only a few simple steps.

  1. sudo apt-get install mysql-server
  2. sudo netstat -tap | grep mysql
  3. sudo vi /etc/mysql/my.cnf
  4. sudo service mysql restart

To look for some simple performance and security suggestions:

  1. sudo apt-get install mysqltuner
  2. mysqltuner

Adding a new user is equally easy…

  1. mysql --user=root --password=mypassword mysql
  2. CREATE USER 'myusername'@'%' IDENTIFIED BY 'mypassword';
    GRANT ALL PRIVILEGES ON *.* TO 'mydatabase'@'%' WITH GRANT OPTION;
    FLUSH PRIVILEGES;

NOTE: This allows access to the user from ALL hosts, it can be limited by replacing the '%' with a specific hostname (such as ‘localhost’ if desired) for security.

REFERENCES:

MySQL (Windows) service startup error 1067

I’ve installed and managed dozens of MySQL installations for several years, occasionally it seems that an install just doesn’t run like it has in the past.

Recently I had a problem where the service would not start (Error 1067) on Windows Server 2003 (R2)… which is running under VMWare. After checking the obvious places and turning up nothing I started down the list of potential solutions exposed by Google search.

The ultimate solution it seems is that the ‘my.ini’ file needed to include the specific path information required by the service…. without it the service would not start.

Here’s my current file (c:\windows\my.ini) for reference:

[WinMySQLAdmin]
Server=C:/mysql40/bin/mysqld-nt.exe
[mysqld]
basedir=c:/mysql40
datadir=c:/mysql40/data

For the really observant readers of this entry… you will notice that this is for MySQL 4.0 (which is no longer officially supported). It’s mostly used as it is widely compatible across various host systems that are sometimes problematic with newer releases.

Cheers.

WAMP Servers

I often find myself administering WAMP (Windows, Apache, PHP/Perl/Python, mySQL) servers…. usually this occurs because it is better ‘supported’ (or perhaps ‘tolerated’) configuration in a corporate alternative to the more common LAMP (Linux… etc.) variety. This gives you the benefit of a centrally controlled operating system while maintaining a mostly open source server environment. Albeit with Microsoft’s poor security record, you’ll be patching it a LOT!

Many common distributions exist… here’s some helpful resources with downloads:

If you are a Java shop, you might also consider the following…

Configuration of each of these is a topic in it’s own right. If you need a shortcut to development, you may want to check out this!

Good luck!!!