Friday, April 16, 2021

How to solve InnoDB: Unable to lock ./ibdata1 mysql error? Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive

Problem Statement:

bash-3.2# /usr/local/mysql/support-files/mysql.server start


Starting MySQL
.................................................................................................... ERROR! The server quit without updating PID file (/usr/local/mysql/data/xx-xxx.pid).
bash-3.2# cat /usr/local/mysql/data/xx-xxxx.pid

 

Root Case :

There might be multiple mysql processes running. Kill them.

Solution:

bash-3.2# ps aux|grep mysql


root             28892   0.9  0.0  4277256    796 s001  S+    1:09PM   0:00.00 grep mysql
 

_mysql           22971   0.0  1.1  4884468 186036   ??  Ss    9:49AM   0:23.22 /usr/local/mysql/bin/mysqld --user=_mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/mysqld.local.err --pid-file=/usr/local/mysql/data/mysqld.local.pid --keyring-file-data=/usr/local/mysql/keyring/keyring --early-plugin-load=keyring_file=keyring_file.so

sudo kill 22971

Restart the server

bash-3.2# /usr/local/mysql/support-files/mysql.server start

Starting MySQL
. SUCCESS!

Additional information

Error Messages from logs could look like:

bash-3.2# cat /usr/local/mysql/data/amoni-mac.err
2021-04-16T07:05:06.321323Z 0 [System] [MY-010116] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.23) starting as process 27393
2021-04-16T07:05:06.324284Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2021-04-16T07:05:06.342917Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-04-16T07:05:06.365435Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
2021-04-16T07:05:07.368910Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
2021-04-16T07:05:08.372637Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35

How to list directories in linux macOS

The following are few of the different ways to list the directories in linux
  1. find * -maxdepth 0 -type d
  2. ls -al | grep '^d'

Thursday, April 15, 2021

How do configure apache web server on MAMP on a Mac?

To install MAMP Read here.

 Open Terminal in Mac

If sudo su (doesn't work)

Use : "sudo -s"

This should bring you to a bash prompt


httpd -v

Server version: Apache/2.4.34 (Unix)
Server built:   Feb 22 2019 20:20:11


apachectl stop
apachectl start

If it's already started, you may see a message similar as follows:
apachectl start
/System/Library/LaunchDaemons/org.apache.httpd.plist: service already loaded
apachectl status

Open "http://localhost:80" in the web browser of your choice.

Stopping a server

apachectl graceful

apachectl -k stop
AH00557: httpd: apr_sockaddr_info_get() failed for amoni-mac
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message

To Unload the server

sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist


In order to avoid the message above,you can configure the server name using the command in the Terminal

vi /etc/apache2/httpd.conf

Look for the following section and uncomment #ServerName <provide a name here>

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName localhost

How do I build a website on Mac, Windows or Linux?

Download the following software on your local machine Mac,Windows or Linux machine.

MAMP - Mac Apache MySQL PHP
XAMPP - Cross-Platform Windows/Mac - Apache MySQL Php and Perl
WAMP - Windows Apache MySQL PHP
LAMP - Linux Apache MySQL PHP - Comes default in Linux OS

 Apache - WebServer 

PHP/Perl - Service side Programming language that is used in combination with browser based a.k.a client client languages HTML,CSS and Javascript for your website look and feel

MySQL - database - store data

Once you build your website and have it running on your machine, you could 

  • Buy domain name
  • Buy a domain hosting space and configure LAMP installed on the host.
  • Use FTP to move files from local machine to server host 

Viola! done

 Additional Info read here

 

Wednesday, April 14, 2021

What is Ansible?

What is Ansible  - Configuration Management Tools - Alternatives to- Chef and Puppet
It is used in Devops.
Business Users: System Admin - infrastructure
Configuration of : N servers x Type of servers(Webserver, Apache, MySQL)

Is is an automation tool? Yes
Yes it helps in IT Automation
Business Scenario : Configuration - 100 apache servers and database servers

Mechanism:
1) Pull Configuration - 2) Push Configuration ( no client installed on nodes, Server pushes)

Core Elements of Ansible:
1st part Core - Playbook
Playbook - instructions to confiugure the node
Written in YAML to describe the data
YAML - YAML ain't a mark up language
...
name: play1
hosts: webserver
tasks:
    -name:install apache
    yum:
        name:apache
        state:present
    -name: start apache
    service:
        name: apache
        state: start
    -name: play 2
    hosts: databaseserver
    tasks:
        -name:install MySQL
2nd Part : inventory


[webserver]
web1.machine
web2.machine

[databaseserver]
db1.machine

 

How it works?
Ansible is installed on the local machine
Connects to different nodes - agentless
Playbook - How to setup remote nodes
Uses SSH to connect to nodes
and Push the Playbook to the node
Create environment that is consistent

 Ansible is a command line tool
Ansible Tower - RedHat - Framework

Usecase: Hootsuite
Business: Social media platform
Problem Statement:
Rebuild their servers
Now they write Playbooks to deploy servers providing a standardization

Take away:
IT Automation consistent configuration

Source:
https://www.youtube.com/watch?v=wgQ3rHFTM4E