alexmontoanelli

a place to have some fun..

Mysql Recover Data using ibdata1, ib_logfile0 and ib_logfile1

Issue:
Unfortunately some times you need to recover MySQL data from ibdata1. It’s many reasons why your getting corrupted Innodb files that cannot automatically be restored of the mysqld daemon.
Solution:
Scenario
We assume that your scenario are like following:
  • You got backup of your ibdata1, ib_logfile0 and ib_logfile1
  • You also got backup of your database folder with .frm files
  • You would like to restore this backup into an MySQL server that’s already in production.

Restore the data backup you got

First of all restore you data on another MySQL server, to not interrupt the services running in your normal production environment. Restore data into the normal MySQL data directory. For our scenario we use /var/lib/mysql.
Be careful to get the right permissions and owners on all your data files. Your MySQL users should own the files and the group should also be assigned to MySQL.
Before you continue you need to find the size of your Innodb logfiles. Simply run the command ls -l to find this. This will output something like this:
-rw-rw—- 1 mysql mysql 5242880 Jun 25 11:30 ib_logfile0
-rw-rw—- 1 mysql mysql 5242880 Jun 25 11:30 ib_logfile1

Start up MySQL in rescue mode

Some simple steps will start up the MySQL daemon in rescue mode for you:
From your Unix shell su into the mysql user: su mysql
Start up your mysqld process with the logfile size and innodb_force_recovery as parameters.
/usr/sbin/mysqld –innodb_log_file_size=5242880 –innodb_force_recovery=6
If everything goes fine you should get a output like this:
InnoDB: The user has set SRV_FORCE_NO_LOG_REDO on
InnoDB: Skipping log redo
070625 11:59:36 InnoDB: Started; log sequence number 0 0
InnoDB: !!! innodb_force_recovery is set to 6 !!!
070625 11:59:36 [Note] /usr/sbin/mysqld: ready for connections.
Version: ’5.0.18′ socket: ‘/var/lib/mysql/mysql.sock’ port: 3306 SUSE MySQL

Get your data

The last simple but most important step is now to get your data.
Open a new shell to the server where your MySQL daemon are running in recovery mode.
Simply run a normal mysqldump of your database:
mysqldump -u root -p database > database.sql
If you get a message looking like this, you got corrupted Innodb log files:
Got error: 1146: Table ‘database.table’ doesn’t exist when using LOCK TABLES
What you can do to resolve this problem with keeping the ib_logfile0 file from you most current backup while you restore all the other files from a older backup. This isn’t a fail-proof solution, but worth a try.

Restore you data

Now you can copy your SQL dump to your production server and simply restore the data from your MySQL dump file like this:
mysql -u root -p database < database.sql
August 14th, 2010 by alexm

Configurando VLANS no Gentoo

How-to rápido de como configurar uma placa de rede com vlans no Gentoo:

Instale o pacote vconfig com um ‘emerge vconfig’;

Configure o arquivo /etc/conf.d/net da seguinte maneira:

vlans_eth0="10 20"
config_eth0="null"
config_eth0_10=("10.100.5.1 netmask 255.255.255.0" )
config_eth0_20=("192.168.2.243 netmask 255.255.255.0")

Nas linhas acima configuramos 2 vlans com as tags 10 e 20, na interface eth0, atribuindo a cada vlan um endereço IP.

Para iniciar a vlan, basta chamar o script default, /etc/init.d/net.eth0 start

Abraços

March 18th, 2010 by alexm

Trick: listando todos os comandos de uma IOS Cisco

Dica básica pra saber todos os comandos de uma IOS Cisco, útil quando sabemos oque queremos mas não sabemos onde encontrar, dá pra combinar com pipes para filtrar.

Exemplos:

#lista todas as configurações do opção router-map
Router#show parser dump route-map
#lista todas as opcoes do menu interface filtrando por ospf
show parser dump interface | include ospf

Abraços

January 25th, 2010 by alexm

Mapeando e usando as teclas múltimidias no linux

Tento instalado os utilitários xev e xmodmap, execute o comando abaixo no console, e aperte as teclas múltimida do seu teclado em sequência.

A saída do comando abaixo será o código da tecla.

xev | sed -n 's/^.*keycode *\([0-9]\+\).*$/keycode \1 = /p'

Após pressionar as teclas, temos seus respectivos códigos e então podemos mapea-las no linux criando um arquivo com a seguinte estrutura:

keycode 144 = F13
keycode 145 = F14

lembre-se de trocar o keycode, no caso 144, pelo resultado obtido ao pressionar as suas teclas múltimidia. Note que o f13, f14 é simbólico.

Após isso salve o arquivo em um local de fácil acesso por exemplo: ~/.xmodmap e execute:

xmodmap ~/.xmodmap

Agora no kde, abra o útilitário ‘keyboard and mouse’ no System Settings, e em Standard e Global Keyboard Shortcuts, você pode definir as ações para suas novas teclas mapeadas.

Abraço

January 16th, 2010 by alexm

Configurando o ‘scroll’ no touchpad com Linux

Abaixo a configuração do xorg.conf para que o touchpad funcione com o recurso de scroll no linux.

Para utilizar, espera-se que touchpad já esta funcionando e paara rolar as páginas, basta deslizar
o dedo na vertical, no lado direito do touch!

Depois de alterado o /etc/X11/xorg.conf, basta reiniciar o X.

Section "InputDevice"
                Identifier "touchpad"
                Driver "synaptics"
                Option "SHMConfig" "true"
                Option         "SendCoreEvents"
                Option         "Protocol" "auto-dev"
                Option      "Device" "/dev/input/mouse2"
                Option  "TouchpadOff" "0"
                Option  "RTCornerButton" "3"
                Option  "LTCornerButton" "2"
                Option  "TapButton1"    "1"
EndSection

Até!

December 17th, 2009 by alexm

Laboratório Cisco Online

Que tal usar equipamentos Cisco de ponta e de verdade, para simular algumas situações de rede, sem ter
que apelar para um emulador?

É oque propõe a equipe do Packetlife. Um lab como  o da foto abaixo é disponibilizado após você agendar um horário,
onde terá acesso a todos os equipamentos por ssh ou telnet durante o período escolhido.

A parceira é a Netgear que fornece um ‘Console Server’ para acessos aos equipamentos.

A proposta é bastante interessante e vale a pena conferir.

Marquei meu horário na sexta as 12h, depois posto os resultados.

Abraços e bons estudos.

lab_topology_ethernet

December 8th, 2009 by alexm
Posted in outros | 1 Comment »

ZendFramework – Usando parâmentros nas Actions

Para quem usa o ZendFramework, em modo MVC, sabe que o modo para pegar uma váriavel  passada por GET/POST/COOKIE, deve ser realizada através dos métodos: getRequest()->getParam(‘nome_da_variavel’), do objeto Zend_Coontroller_Action.

Abaixo mostro uma implementação, que extende a classe Zend_Action para que seja usado os parâmentros no corpo da função.

Hoje você utiliza da seguinte forma:

<?php
class IndexController extends Zend_Controller_Action {

public function indexAction(){

//obterá o parâmentro GET/POST teste
 echo $this->getRequest()->getParam('teste');

}

}

A nova forma será:

<?php
class IndexController extends My_Action {

public function indexAction(string $teste){

//obterá o parâmentro GET/POST teste
 echo $teste;

}

}

Abaixo a classe My_Action.

Abraços

—————

<?php                                                                                                                                  
/**                                                                                                                                    
 * Map request parameters to action method                                                                                             
 * @author Albert Varaksin                                                                                                             
 * @licence public domain                                                                                                              
 */                                                                                                                                    
class My_Action extends Zend_Controller_Action                                                                           
{                                                                                                                                      
 /**                                                                                                                                
 * Dispatch the requested action                                                                                                   
 *                                                                                                                                 
 * @param string $action Method name of action                                                                                     
 * @return void                                                                                                                    
 */                                                                                                                                
 public function dispatch($action)                                                                                                  
 {                                                                                                                                  
 // Notify helpers of action preDispatch state                                                                                  
 $this->_helper->notifyPreDispatch();                                                                                           

 $this->preDispatch();
 if ($this->getRequest()->isDispatched()) {
 if (null === $this->_classMethods) {  
 $this->_classMethods = get_class_methods($this);
 }                                                   

 // preDispatch() didn't change the action, so we can continue
 if ($this->getInvokeArg('useCaseSensitiveActions')
|| in_array($action, $this->_classMethods)) {
 if ($this->getInvokeArg('useCaseSensitiveActions')) {                                       
 trigger_error('Using case sensitive actions without word separators is deprecated;
please do not rely on this "feature"');
 }                                                                                                                             

 $reflMethod = new Zend_Reflection_Method($this, $action);                                                                     
 $actionParams = $reflMethod->getParameters();                                                                                 
 $requestParams = $this->_request->getParams();                                                                                
 $args = array ();                                                                                                             
 foreach ($actionParams as $param)
 {
 // get parameter type
 if (($reflClass = $param->getClass()) instanceof Zend_Reflection_Class) {
 $type = $reflClass->getName();
 } else if ($param->isArray()) {
 $type = 'array';
 } else {
 $type = $param->getType();
 }

 // get passed parameter
 $name = $param->getName();
 if (isset($requestParams[$name])) {
 $value = $requestParams[$name];
 } else if ($param->isDefaultValueAvailable()) {
 $value = $param->getDefaultValue();
 $type = '';
 } else {
 $docBlock = $reflMethod->getDocblock();
 if (($tagRefl = $docBlock->getTag("require_$name"))
instanceof Zend_Reflection_Docblock_Tag) {
 $tryClass = trim($tagRefl->getDescription());
 if (class_exists($tryClass, true))
 throw new $tryClass("Missing value for argument $name");
 else
 throw new Zend_Controller_Action_Exception("Missing value for argument $name");
 }
 $value = null;
 }

 // fix value type
 $basicTypes = array(
 'int', 'integer', 'bool', 'boolean',
 'string', 'array', 'object',
 'double', 'float'
 );
 if (in_array($type, $basicTypes)) settype($value, $type);
 else if (strlen($type) && class_exists($type, true)) $value = new $type($value);

 $args[] = $value;
 }
 // dispatch the action
 call_user_func_array(array($this, $action), $args);
 } else {
 $this->__call($action, array());
 }
 $this->postDispatch();
 }

 // whats actually important here is that this action controller is
 // shutting down, regardless of dispatching; notify the helpers of this
 // state
 $this->_helper->notifyPostDispatch();
 }
}
October 17th, 2009 by alexm

[VideoSet] DJ RicaTelles ClipMix (2009) Vol02

[VideoSet] DJ RicaTelles ClipMix (2009) Vol02
## Este novo VideoSet soma alguns sucessos do Volume 1 + super lançamentos!!! ##

DJ_RicaTelles_ClipMix_2009_Vol02_[HouseSessions].mkv – 350MB
Este arquivo segue um novo padrão escolhido para este e os próximos releases do DJ RicaTelles, qual retrata o melhor custoXbenefício em Áudio e Vídeo para Internet da atualidade, denominado “.MKV” (Matroska); Outro fator adotado é o Set com time aproximado de 30 minutos e o tamanho do arquivo fixo de 350MB para facilitar os downloads.

Baixe agora mesmo o VideoSet Volume 2

emule http mp3

— DJ RicaTelles ClipMix 2009 Volume 2 [House Sessions] —
01 Voxis vs Dj Andi – To The Moon
02 David Deejay ft Dony – So Bizzare
03 Sander Van Doorn vs Robbie Williams – Close My Eyes
04 Edward Maya ft Vika Jigulina – Stereo Love
05 Akcent – That’s My Name
06 Morris – Desire
07 David Deejay ft Dony – Nasty Dream
08 Nick Kamarera ft Deepside Deejays – Beautiful Days
09 Bob Taylor ft Inna – Deja Vu
10 Inna – Love
11 Play and Win – Only
12 Fonzerelli – Dreamin

Abraços

September 22nd, 2009 by alexm
Posted in outros | 1 Comment »

TwitterFeed

Bom inauguro minha expêriencia no twitter, divulgando o excelente serviço  http://twitterfeed.com/, quem tem como objetivo, auxiliar bloqueiros de plantão, na divulgação de seus trabalhos.

tweetefeed

Em 2 simples passos você configura o serviço, para que poste automaticamente no seu twitter oque for publicado no seu blog.

O serviço usa autenticação OpenID, ou seja não requer cadastro.

Uma mão na roda pra que vive postando e não tem tempo nem saco, pra divulgar em todos os locais.

Enjoy.

July 22nd, 2009 by alexm

Divulgação – Dj RicaTelles

Segue links de um vídeoclip mixado pelo meu grande amigo Ricardo.

parte1

parte2

parte3

just audio

emule – versão dvd

——–

Set DJ RicaTelles ClipMix (2009) [ElectroHouse]

Este é o primeiro set que publico aos amantes da House Music e suas vertentes...

A novidade é que este set foi mixado em Áudio e Vídeo,
para curtir o som e assistir ao clip!

PlayList:

01 - nick kamarera ft deepside deejays - beautiful days

02 - david_deejay ft dony - nasty dream

03 - morris - desire

04 - skreatch & Joe Smooth - promised milkshake

05 - guru josh project - infinity

06 - tikaro j louis and ferran ft clarence - shine on me

07 - desaparecidos vs walter master j - ibiza

08 - tomer g - i like it

09 - eddy wata - i love my people

10 - jesse mccartney - leavin

11 - rihanna - dont stop the music

12 - cyndi lauper - into the nightlife

13 - ne-yo - because of you

14 - timbaland ft one republic - apologize

15 - bodyrox & luciana - what planet you on

16 - eva jane - spinning around

17 - mondotek - alive

18 - elektronique - move that thing

19 - rank1 - led (there be light)

20 - markus schulz - the new world

21 - deadmau5 by tiesto - not exactly

Críticas e sugestões são bem vindas!!!

Em breve, um novo set...

(Censura 14 anos)

Link da Comunidade do DJ RicaTelles

http://www.orkut.com.br/Main#Community.aspx?cmm=91419553
July 6th, 2009 by alexm