Tuesday, May 22, 2018

Sonarqube Tutorials


Installing plugin in SonarQube
------------------------------

1. Download plugin. Example is a typescript plugin.
sonar-typescript-plugin-1.6.0.2388.jar

2. Copy plugin to /opt/sonar/extensions/plugin

3. Restart sonar
service sonar restart

4. Take note that some plugins needs higher version of sonarqube. If needed,
upgrade sonar instance first

Upgrading Sonar Instance
------------------------

1. Download sonarqube from https://www.sonarqube.org/downloads/

2. Stop sonarqube
service sonar stop

3. Rename old installation directory
mv /opt/sonar /opt/sonar_old

4. Extract new sonar version to /opt (fix the underlying paths if needed)
unzip .zip /opt

5. Edit the following files and get the values from the old config
vi /opt/sonar/conf/sonar.properties
vi /opt/sonar/conf/wrapper.conf

6. Apply correct permissions
chown -R sonar:sonar /opt/sonar

7. Start sonar
service sonar start

8. Do a database migration if needed by going to http://sonar.host:8080

Monday, May 21, 2018

Troubleshooting boot issues in Linux


Missing boot loader
Error:


  


  - this means your boot loader cannot be found
  - it might be removed (rm -fr /boot/grub2)
  - or corrupted (dd if=/dev/zero of=/dev/sda bs=1 count=446)

Solution:
1. Insert installation disc and boot into rescue mode
2. Acces /: # chroot /mnt/sysimage
3. Rebuild grub: # grub2-install /dev/sda
4. Check if grub.cfg is present, if not, recreate it: # grub2-mkconfig -o /boot/grub2/grub.cfg
5. # exit
6. # exit
Missing initramfs/initrd
Error:






- initramfs might be deleted

Solution:
1. Insert installation disc and boot into rescue mode
2. Access /: # chroot /mnt/sysimage
3. Check if initramfs is really gone: # cd /boot && ls -l *initramfs*
4. Build an initramfs: # dracut
5. # exit
6. # exit
Missing kernel
Error:


  




- vmlinuz* might be deleted

Solution:
1. Insert installation disc and boot into rescue mode
2. Copy kernel rpm to sysimage: # cp /run/installer/repo/Packages/kernel-3.10*rpm /mnt/sysimage/tmp
3. Switch to /: # chroot /mnt/sysimage
4. Install unpatched/base kernel: # rpm -ivh /tmp/kernel-3*rpm --force
5. # exit
6. # exit
GRUB 2 config file is missing but you don't have a rescue disc
Error:
A reboot will drop you to this shell







  - if GRUB cannot find the config file (grub.cfg), it will drop you down to a shell shown above
  - from that shell, you will be able to enter commands interactively

Solution:
1. Since we don't have a rescue disc, we cannot boot into rescue mode and recreate grub.cfg
2. So we are left with a grub shell
3. Determine what partitions holds the grub.cfg, kernel, and initrd
      grub> ls (hd0)/
      grub> ls (hd0,1)/
      grub> ls (hd0,msdos2)/
      grub> ls (hd0,msdos1)/
4. If you got it, set it as root partition
      grub> set root=(hd0,msdos1)
5. Set the path to kernel and specify location of root filesystem
      grub> linux /vmlinuz-3.10.0-514.el7.x86_64 root=/dev/mapper/cl-root
6. Set the initramfs path
      grub> initrd /initramfs-3.10.0-514.el7.x86_64.img
7. Boot now
      grub> boot
8. Once you are able to login, you can now recreate grub.cfg
      # grub2-mkconfig -o /boot/grub2/grub.cfg
9. You have now a working grub menu
      # systemctl reboot
some modules are missing from the GRUB 2 folder
Error:

  




- this is the grub rescue shell

Solution:
Most of the minimal modules that is used by Grub has been corrupted so best thing
to do is a rebuild grub from resuce disk.
Recreating GRUB 1 config file in RHEL 6
If /boot/grub/grub.conf is lost, there is no "grub-mkconfig" command to help you. So you need to recreate it from scratch. You can do it in several ways.

* Recreating grub.conf from rescue mode *

1. Insert installation disc and boot from rescue mode
2. Go and access your files: # chroot /mnt/sysimage
3. Create grub.conf: # /boot/grub/grub.conf
4. Enter the following:
default=0
timeout=5

splashimage=(hd0,0)/grub/splash.xmp.gz
title Red Hat 6
root (hd0,0)
  kernel /vmlinuz-2.6.0-514.el7.x86_64 root=/dev/mapper/VolGroup-lv_root
  initrd /initrd-2.6.0-514.el7.x86_64.img
5. Save and quit
6. Exit chrooted environment: # exit
7. Exit rescue mode to reboot: # exit

* Via grub shell method*

1. When you reboot while grub.conf is missing, you will be dropped to grub shell
2. Enter the following commands from grub shell
  grub> root (hd0,0)
  grub> kernel /vmlinuz-2.6.0-514.el7.x86_64 root=/dev/mapper/VolGroup-lv_root
  grub> /initrd-2.6.0-514.el7.x86_64.img
  grub> boot
3. Onced you are on the OS shell, recreate grub.conf
  # vi /boot/grub/grub.conf
  # enter the following:
default=0
timeout=5

splashimage=(hd0,0)/grub/splash.xmp.gz
title Red Hat 6
root (hd0,0)
  kernel /vmlinuz-2.6.0-514.el7.x86_64 root=/dev/mapper/VolGroup-lv_root
  initrd /initrd-2.6.0-514.el7.x86_64.img
4. Save and quit
5. Reboot
Non-existent device in /etc/fstab
Problem:
If you have a non-existent entry in fstab, let's say you removed a filesystem from LVM but forgot to remove it from /etc/fstab, your next boot will look like this:

This is your clue - during bootup, systemd/init will tell you that it cannot find a specific device. So you need to check fstab for non-exsiting devices.








Then you will be dropped to emergency shell:








Solution:
1. Provide the root password and enter
2. Check fstab for non existent devices by: # mount -a
3. Remove or comment it from fstab
4. Check again if all are OK: # mount -a
5. Reboot: # systemctl reboot
Missing /etc/grub.d contents
Reinstall grub2-tools:
# yum reinstall grub2-tools -y
Wrong kernel boot parameters
These are the errors/issues you will encounter when the corresponding boot parameter is incorrect/missing

# wrong root=/path/to/rootfilesystem
  -> your kernel might panic (seen on centos 7)
  -> or you will see dracut timing out (seen on centos 7)

Friday, May 18, 2018

Netapp Terminologies & Concepts


aggregate
 physical disk, raw space, doesn't hold data
volumes
 these are inside aggregates, it holds the data
LUN
 logical repressentation of storage





hot spare disks
A hot spare disk is a disk that is assigned to a storage system but is not in use by a RAID group. It does not yet hold data but is ready for use.

If a disk failure occurs within a RAID group, Data ONTAP automatically assigns hot spare disks to RAID groups to replace the failed disks.
What disks can be used as hot spares?
A disk must conform to certain criteria to be used as a hot spare for a particular data disk.
For a disk to be used as a hot spare for another disk, it must conform to the following criteria:
It must be either an exact match for the disk it is replacing or an appropriate alternative.
The spare must be owned by the same system as the disk it is replacing.
CIFS Oplocks
- CIFS oplocks reduce network traffic and increase the storage performance.
- Its working like caching of read-ahead, write-behind, and lock information.
- you can enable/disable CIFS oplocks for the individual volume or qtree.
- In the database application we should turn off the CIFS oplocks - when you
  handling critical data and can't afford the data loss.
- Otherwise, you can on  CIFS oplocks options.
spindles
- # of spindles = # of physical disks
- there is one spindle in each physical disk
- more spindles means more disks
- more spindles for better performance in terms of I/O! (solution to sata slowness)
- more spindles will process more data at a time
provisioning
- thin provision is space reservation
- thick provisioning is no space reservation







Thursday, May 17, 2018

DataDomain Deduplication


Data deduplication looks for redundancy of sequences of bytes across very large
comparison windows. Sequences of data (over 8 KB long) are compared to the
history of other such sequences. The first uniquely stored version of a sequence
is referenced rather than stored again. This process is completely hidden from
users and applications so the whole file is readable after it's written.

/data -->   this is were your files (files from CIFS shares)
            and backups (backups from backup softwares like Veritas, SQL, etc)
            reside; storage file system
/ddvar -->  resembles unix filesystems (log directories, etc); administrative
            filesystem
/backup --> common directory for CIFS shares (used in older DD OS versions)

Data Domain is a deduplicated device meaning all data you send to it will be
deduplicated and compressed. For example, if you sent a 100 TB data, expect that
the size of that data is much lower inside the DD. It may be 10 TB, 15TB, or
5 TB depending on the compression ratio.

As an example:
sysadmin@dd01# filesys show space

Active Tier:
Resource           Size GiB   Used GiB   Avail GiB   Use%   Cleanable GiB*
----------------   --------   --------   ---------   ----   --------------
/data: pre-comp           -   418498.9           -      -                - # this line tells you the actual size of data sent to the DD (uncompressed data)
/data: post-comp    64766.3    59730.8      5035.5    92%            244.0 # this line tells you the size of virtual data inside the DD specifically on the "Used GiB" column (compressed data)
/ddvar                 29.5       13.3        14.7    48%                -
----------------   --------   --------   ---------   ----   --------------
 * Estimated based on last cleaning of 2015/02/17 11:55:17.
sysadmin@dd01#
The output above will also tell you how large is the capacity of your DD
(approx 65 TB).

Wednesday, May 16, 2018

Connecting to MySQL DB


Ways of Connecting
==================

prompt> mysql

  # default hostname is localhost
  # default user is current user for Linux and "ODBC" for windows
  # 1st non-option parameter is treated as default database

shell> mysql --host=localhost --user=myname -pMyInsecurepass123 mydb

  # there must be no space between "-p" and the actual password
  # this form is insecure because the password is in cleartext, it is possible
    to be seen in "history" or "ps auxw"

shell> mysql -h network-db.com -u myname -p mydb

  # this will prompt user for password
  # secure compared to the previous

Notes on Credentials
====================

* MySQL doesn't have a limit on password length
* If system library limits password to 8 characters or less, MySQL password
  can be adjusted to adapt to it
* credentials can be set under ~/.my.cnf following this format

[client]
host=localhost  # you can ommit this line
user=root
password=Pass123^^

Choosing Port and Host
======================

You can choose host and port using the following format:

mysql --port=13306 --host=127.0.0.1

You may also store the hostname in MYSQL_HOST environment variable.

Installing Netbackup 6.5 on Windows Media Server

Installation
============

Master Server: Solaris 10
Media Server: Windows

1. install Netbackup Media Server software on mediaserver.net
  - target NBU version is 6.5.X
  - run installer > choose NetBackup Media Server > paste license key (installation is pretty straight forward)

2. edit HKEY_LOCAL_MACHINE\Software\VERITAS\NetBackup\CurrentVersion\Config
  - add hostname of media servers that will backup the local host in "MEDIA_SERVER"
  - add hostname of master server in "EMMSERVER"
  - add hostname of client in "Client_Name"

3. edit /usr/openv/netbackup/bp.conf on the master server
  - append the following line: MEDIA_SERVER = mediaserver.net

4. add the media server in EMMDB
nbemmcmd -addhost -machinename mediaserver.net -machinetype media -masterserver masterserver.net -operatingsystem windows -netbackupversion

5. restart NBU service on media server
C:\Program Files\Veritas\NetBackup\bin\bpdown.exe
C:\Program Files\Veritas\NetBackup\bin\bpup.exe

6. restart NBU service on master server
bp.kill_all
bp.start_all
 
Post Checks
===========

1. from master server
ping mediaserver.net
nslookup mediaserver.net
nslookup mediaserver.net
bptesbpcd -client mediaserver.net
bpgetconfig -s mediaserver.net
bpclntcmd –hn mediaserver.net
bpclntcmd –ip mediaserver.net

2. from media server
bpclntcmd –pn
nbemmcmd –getemmserver

3. test backup using that media server

Additional Steps for media servers attached to a DataDomain
===========================================================

1. Create Storage server
nbdevconfig -creatests -st 9 -stype DataDomain -storage_server dd01.net -media_server mediaserver.net

2. Install DD BOOST plugin (separate tutorial)

3. Add storage server credential
tpconfig -add -storage_server dd01.net -stype DataDomain -sts_user_id admin -password pass123ost

4. Verify on Master server Java console if media server is now authorized
Media and Device Management > Credentials > Storage Servers

Netbackup Ports and Daemons


Daemons & Ports
===============

DAEMON
PORT
DESCRIPTION
bpcd
13782
The NetBackup Client daemon, this process issues requests to and from the master server and the media server to start programs on remote hosts.
vnetd
13724
Veritas Network Daemon allows all socket communication to take place while connecting to a single port.
bprd
13720
NetBackup Request Manager service; It starts the automatic backup of clients and responds to client requests for file restores and user backups and archives.
nbrmms
N/A
The process for the NetBackup Remote Manager and Monitor service. Enables NetBackup to remotely manage and monitor resources on a system that are used for backup (or affected by backup activity).
ltid

This needs only to be started when there are drives configure on the server
nbrb

resource broker
nbstserv

Storage Lifecycle Manager service - creates duplication jobs

NOTE:
- In linux systems, xinetd must be installed in order for bpcd and vnetd to work
- More info on daemon and processes is on page 62 of "Veritas Netbackup 6.5 - Administrator's Guide Vol 1"