Category Archives: oracle

All things Oracle (Unfortunately)

Galera / WSREP – MySQL cluster on Ubuntu 12.04 LTS – basic initial setup

mysql-logoIt took me about 4 hours of actual research, and trial and error, however I finally got a working Galera based WSREP MySQL cluster up and running. Here’s what it took and how the pieces came together:

Getting the install right took a couple of hours by itself for some reason, here’s the order that worked best on Ubuntu 12.04 LTS:
Continue reading

Weblogic Linux service script

Seeing as how a ton of the work I do these days is with Weblogic, I figured it would come in handy to have an init script tucked away for a rainy day. Recently we had an Oracle consultant in to deploy Oracle Business Intelligence, Enterprise Edition and while I can say the consultant knew too little about systems, in the same breath I would say he knows too much about OBIEE. He put together an init script for OBIEE which is based on Weblogic so I borrowed and mangled what he started with to fit my needs and this was the outcome.

#!/bin/bash
# Weblogic start / stop script.
#
# chkconfig: 345 99 10
# description: Manage Weblogic services.
#


SRVC_OWNR=<user>                    # Local Unix user running Weblogic
WL_BIN=/path/to/Oracle/Middleware   # Deployment root directory
WL_USER=wl_admin_user               # WL administrator name
WL_PASSWD=<password>                # WL administrator password
WL_DOMAIN=<wl_domain>               # Domain name
Mgmt_SERVER=<admin_server>          # Admin server name
MS_SERVER=<ms1>                     # Managed server name
ADMIN_URL=<host>:<port>             # Admin server URL (hostname:port)
MS_URL=<host>:<port>                # Managed server URL (hostname:port)
WL_PATH=$WL_BIN/wlserver_10.3/server/bin
WL_DOMAIN_PATH=$WL_BIN/user_projects/domains/$WL_DOMAIN/bin
export WL_DOMAIN_PATH

START_LOG=/var/log/wl-start.log
STOP_LOG=/var/log/wl-stop.log
SUBSYS=wl_svcs

start() {

    echo "********************************************************************************"
    echo "Starting Node manager on $(date)"
    echo "********************************************************************************"
    su $SRVC_OWNR -c "$WL_PATH/startNodeManager.sh" &
    wait_for "Secure socket listener started on port 5556"

    echo "********************************************************************************"
    echo "Starting Admin Server on $(date)"
    echo "********************************************************************************"
    su $SRVC_OWNR -c "$WL_DOMAIN_PATH/startWebLogic.sh" &
    wait_for "Server started in RUNNING mode"

    echo "********************************************************************************"
    echo "Starting Managed Server $MS_SERVER on $(date)"
    echo "********************************************************************************"
    su $SRVC_OWNR -c "$WL_DOMAIN_PATH/startManagedWebLogic.sh $MS_SERVER http://$ADMIN_URL" &
    wait_for "Server started in RUNNING mode"

    echo "********************************************************************************"
    echo "Weblogic start sequence completed on $(date)"
    echo "********************************************************************************"
}
stop() {

    echo "********************************************************************************"
    echo "Stopping Managed Server $MS_SERVER on $(date)"
    echo "********************************************************************************"
    su $SRVC_OWNR -c "$WL_DOMAIN_PATH/stopManagedWebLogic.sh $MS_SERVER t3://$ADMIN_URL $WL_USER $WL_PASSWD"

    echo "********************************************************************************"
    echo "Stopping Admin Server $Mgmt_SERVER on $(date)"
    echo "********************************************************************************"
    su $SRVC_OWNR -c "$WL_DOMAIN_PATH/stopWebLogic.sh"

    echo "********************************************************************************"
    echo "Stopping Node manager on $(date)"
    echo "********************************************************************************"
    su $SRVC_OWNR -c "kill -9 $( ps -ef| grep weblogic.NodeManager | grep -v grep | awk '{print $2}' )"

    echo "********************************************************************************"
    echo "Weblogic stop sequence completed on $(date)"
    echo "********************************************************************************"
}

wait_for() {
    res=0
    while [[ ! $res -gt 0 ]]
    do
        res=$(tail -5 "$START_LOG" | fgrep -c "$1")
        sleep 5
    done
}

case "$1" in
    start)
        echo "********************************************************************************"
        echo "Starting Weblogic Components on $(date)"
        echo "Logs are sent to $START_LOG"
        echo "********************************************************************************"
        start &> $START_LOG &
        touch /var/lock/subsys/$SUBSYS
    ;;
    stop)
        echo "********************************************************************************"
        echo "Stopping Weblogic Components on $(date)"
        echo "Logs are sent to $STOP_LOG"
        echo "********************************************************************************"
        stop &> $STOP_LOG
        rm -f /var/lock/subsys/$SUBSYS
        ;;
    *)
        echo "Usage: $(basename $0) start|stop"
        exit 1
esac

exit 0

If you’ve ever worked with Weblogic the script should be fairly self explanatory. The script starts node manager, waits for completion, then moves on to an admin server and managed server; comment one or the other out based upon your needs.

multipath.conf: uid, gid, and mode persistency


Oracle, how I loathe thee. Let me count the ways! Getting disk ownership and permissions setup for ASM can be a P.I.T.A. to maintain when using raw devices and rc.local to set permissions. Enter uid, gid, and mode settings for multipath.conf. Here’s how you can setup your multipath stanzas to set multipath device ownership and permissions:

Consider the following multipath device:

multipath {
      wwid "112233445566778899001122334455667"
      alias asm-disk1
}

Now add the “uid“, “gid“, and “mode” settings where “uid” and “gid” correspond to the literal user ID and group ID you want to own the device and “mode” is the octal permissions you would like to apply:

multipath {
      wwid "112233445566778899001122334455667"
      alias asm-disk1
      uid 20000
      gid 20000
      mode 775
}

Now reload multipath settings from file with [root@localhost ~]# service multipathd reload

NOTE: This will only load the settings into memory and your permissions will not be persistent across reboots until you remake your initrd image in RHEL 5:

[root@localhost ~]# mv /boot/initrd-$(uname -r).img /boot/initrd-$(uname -r).img.bak
[root@localhost ~]# mkinitrd /boot/initrd-$(uname -r).img $(uname -r)

Your ASM disk should have the user and group set with the correct permissions and should persist across reboots:

brwxrwxr-x 1 20000 20000 253, 2 Aug 18 16:00 asm-disk1

how to: Weblogic 10.3.4 – attach node manager to domain…

This is necessary to setup a Weblogic cluster.  Seems the majority of Weblogic setups we do are not clustered (For whatever reason).
connect (‘<wlAdminUser>’,'<wlAdminUserPW>’,’t3://<ipOfAdminServer>:<adminServerPort>’)
nmEnroll(‘/<path>/<to>/<domain>’,'<wlBaseInstallDir>/Oracle/Middleware/wlserver_10.3/common/nodemanager’)