Wednesday, 12 June 2013

Linux_interview_questions_2

link: http://isitup.wordpress.com/tag/linux-administrator-interview-questions/

Bash:
  1. How do you find out if a shell command succeeded or not?
  2. Write a command line to delete files in /tmp across say 400 machines.
  3. What do $?, $!, $@ stand for?
  4. Write a shell script that replaces the shell command which.
  5. What is your favorite shell and why?
  6. What does . mean in regular expressions?
  7. Write a regular expression that does that matches this
  8. What is the output of ls -l ?
  9. What does the stat command do?
  10. What is difference between ” and ‘  ?
  11. How will you change root password on 10K servers and you have no ssh keys? What will you do if it is 100K servers?  [ANS: http://amitmund.blogspot.in/2013/10/ssh-tips.html ]
Databases:
  1. What are  the differences between innodb vs myisam?
  2. How can you tell if replication is functional?
  3. What does sharding mean to you?
  4. What does explain mean to you?
  5. What are the general parameters you tune for MySQL?
  6. What can you do to shutdown a Oracle database that you cannot sqlplus into?
DNS:
  1. What is the difference between A record and CNAME record?
  2. Why PowerDNS over BIND?
Editors:
  1. Emacs vs VI what’s your choice and why?
  2. Wait, what you use nano?
Configuration Management:
  1. What is puppet? Why do you use it?
  2. What do you need to do  rebuild a puppet master on the fly?
  3. What is the keyword for forcing one-operation after another operation in a puppet manifest?
Mail:
  1. Describe a SMTP transaction with commands.
Networking:
  1. What is the difference between TCP vs UDP?
  2. How  do ping and traceroute work? Do get into details about TTL.
  3. Can you tell me the command line for tcpdump to capture traffic on port 22 on interface eth0?
  4. Can you describe how routing works?
  5. Describe a HTTP transaction in all detail you can.
  6. What is a VLAN? Why do you need VLANS?
  7. What are the port numbers for pop,imap,http,https,dns?
  8. What is a spanning tree?
  9. What are MSS and MTU?
  10. Explain when you would use UDP and when you would use TCP.
  11. What is supernetting?
  12. How many bits in an IPV4 address?
  13. What is the difference between Class address and CIDR?
  14. Describe a DNS transaction in great detail.
NFS:
  1. What is the possible reason that a nfs server would appear to be slow when serving large files but quite fast when serving small files?
  2. What is your experience with nfs?
Operations:
  1. Do hostnames need a sequence number in their naming convention? Why/Why not?
  2. How do you deal with multiple issues that come up?
  3. How do you deal with developers?
  4. How do you handle aggregating logs files?
  5. Describe whats your strategy for disaster recovery?
  6. A client says he/she is expected to receive 5million hits, what hardware do you recommend?
  7. What Linux distribution would recommend for a business?
  8. Do you have any issues with running Windows in production?
  9. Describe your ideal job?
  10. Describe what you would like to do?
  11. What are your thoughts on how a release process should be?
  12. What are your thoughts on monitoring?
  13. Design a high level detail for a LAMP stack and DR solution.
Operating Systems/Distributions
  1. What’s your favorite Linux distro and why?
  2. How do you go about recommending what distro to use for a business?
  3. What is an inode?
  4. What is the difference between a soft link and a hard link?
  5. Can you create a directory/filename by the name -f ? If so how?
  6. What is uptime?
  7. What is load average? What do those numbers mean?
  8. What does it mean when someone says there is high load?
  9. When can you have such a high load of 400 and yet have low CPU usage?
  10. What is a semaphore?
  11. What is is a signal?
  12. Can you name few signals?
  13. What does set group id for a directory mean?
  14. What are the different kinds of files?
Security :
  1. How do you secure a linux system?
  2. What is a sql injection attack?
  3. What is the command to manipulate kernel level firewall?
Misc:
  1. Where do you get your news?
  2. What are you favorite set of tools you like to have always?
  3. Tell us a joke.

External_Good_Links

http://stackoverflow.com/

http://serverfault.com/

http://meta.stackoverflow.com

http://superuser.com

http://programmers.stackexchange.com

http://webapps.stackexchange.com/

http://security.stackexchange.com/

http://dba.stackexchange.com/

http://askubuntu.com/

http://unix.stackexchange.com/

http://stackexchange.com/

http://www.michael-noll.com/

http://www.thegeekstuff.com/

http://graphite.wikidot.com/

http://graphite.wikidot.com/faq

http://graphite.wikidot.com/start 

http://graphite.readthedocs.org 

http://tompurl.com/2011/08/12/installing-graphite-on-ubuntu-10-4-lts/

http://www.smilecouple.org/2011/03/01/fix-out-of-resource-problem-with-mysql 

http://kaivanov.blogspot.in/

http://www.americanscientist.org/issues/pub/2002/3/the-easiest-hard-problem/2

http://www.slideshare.net/sudhirpg/ganglia-monitoring-tool

http://www.ibm.com/developerworks/library/l-ganglia-nagios-1/

http://blogs.hbr.org/cs/2013/02/write_e-mails_that_people_wont.html

http://redis.io/

http://redis.io/topics/data-types#strings

http://redis.io/documentation

http://try.redis.io/

http://redis.io/commands

Hadoop Operations:  [http://www.amazon.com/Hadoop-Operations-Eric-Sammer/dp/1449327052/ref=pd_sim_b_1 ]

http://www.tummy.com/articles/isolating-heavy-load/

http://www.tummy.com/

http://cherry.world.edoors.com/

http://www.infoworld.com/d/application-development/10-programming-languages-could-shake-it-181548

AWS_Amazon_Spot_Instance

AWS: Amazon spot instance:

The purpose of using an Amazon Spot instance is for:
1. To save money (it’s cheaper to run servers on Amazon as Spot instances) 
2. To make recovering a failed instance very fast and easy.

Q1. How this is cheaper?
Few example: 

http://www.youtube.com/embed/WD9N73F3Fao?rel=0&hd=1
http://www.youtube.com/embed/BD1X5ItelOk?rel=0&hd=1

Because, even if we have bid for the higher price, its charges for the current spot price. 

Example: 
1. A linux c1xl server's current bid price is $0.070 [ 7 cents only per hour ]
2. The On demand price is around $0.50 [ 50 cents per hour]

and out bid price is $0.75 [ 75 cents per hour ] which is higher even the on demand price, but how its can cost less? Because its charge on the current spot price [ which is 7 cents now]. Then why we are requesting for that high bid price [ around 75 cents ] even higher then spot price?

Note that, the spot instance goes away if some one bid in higher price, so when we have our bid price is more then the on-demand price, then most likely we have a higher chances that out hosts will not go down, and the spot price stay much lower then on demand price for a longer time. Hence we save an overall money and a higher chances of getting the spot instance for longer time.

For more details, please follow the above youtube links.

A Spot Instance on Amazon is how customers can ‘bid’ for unused capacity on Amazon’s infrastructure. The cost to run a Spot Instance is always fluctuating. As long as that cost is below the maximum ‘bid’ price that we bid, then the server continues to run.  However, when Amazon has system issues, network issues, etc, then the current Spot Instance price will go up, exceeding our maximum bid price. When this happens, the server will be terminated instantly without any warning.  Therefore, Spot Instances are useless for things like a Database Server. And they are only useful for areas of the product that are designed to take advantage of them.

AWS wiki link: http://aws.amazon.com/ec2/spot-instances/ [ Further details ]




Spot Instance Issues
A Spot Instance has to be set up in a special way in order for it to work correctly.

When our maximum ‘bid’ price is exceeded, the server will be terminated. Then, when the current price drops back below our maximum bid price, the server will be re-launched. When it is re-launched, it’s like it was launched for the first time: it gets a new InstanceId, all data is lost, etc. Therefore, any data that must be retained has to be on a separate EBS volume.

Also, the IP addresses that the spot instance uses will also change when it is re-launched. This causes issues for both monitoring and for database access, since the server’s IP address is used for both.

This means that the Spot Instance must have boot-up scripts that:
- mount an /ebs volume where the data is stored,
- all data that we change on a regular basis (Apache Document Root, etc) must be links from the root disk to locations under /ebs
- we must assign an Elastic IP address when the instance boots up, so it gets the same public IP address and Amazon DNS name each time it is re-launched. The Amazon DNS name will not change, but the Private IP Address that it resolves to *does* change.


Monday, 20 May 2013

Media Coversion with avconv

This is the note on using some tools at "Ubuntu" to convert different file type of source to multiple destination file type at the destination:


NOTE: 
The bit rate is quantified using the bits per second (bit/s or bps) unit.

MP3

The MP3 audio format lossy data compression. Audio quality improves with increasing bitrate.

    32 kbit/s - generally acceptable only for speech
    96 kbit/s - generally used for speech or low-quality streaming
    128 or 160 kbit/s – mid-range bitrate quality
    192 kbit/s - a commonly used high-quality bitrate
    320 kbit/s - highest level supported by MP3 standard

 Video

    128–384 kbit/s – business-oriented videoconferencing quality using video compression
    1.5 Mbit/s max – VCD quality (using MPEG1 compression)[16]
    9.8 Mbit/s max – DVD (using MPEG2 compression)[17]
    8 to 15 Mbit/s typ – HDTV quality (with bit-rate reduction from MPEG-4 AVC compression)
    19 Mbit/s approximate — HDV 720p (using MPEG2 compression)[18]
    24 Mbit/s max — AVCHD (using MPEG4 AVC compression)[19]
    25 Mbit/s approximate — HDV 1080i (using MPEG2 compression)[18]
    29.4 Mbit/s max – HD DVD
    40 Mbit/s max – Blu-ray Disc (using MPEG2, AVC or VC-1 compression)[20]

I believe youtube 320p use somewhere around 720k  [.7M] bit rate. 


The lower the bit rate the lesser the filesize but it will reduce the file quility, mean while if you use higher bit rate then the original file then you will find empty bits and that is not good.


=========================================================================
 
-> Package needed "ffmpeg"

Converting "mkv" file to "mp4" file.
 avconv -i "file_name.mkv" -c copy "file_name.mp4"

avconv [global options] [[infile options][-i infile]]... {[outfile options] outfile}...

Specified by the "-i" option, and writes to an arbitrary number of output "files", which are specified by a plain output filename. As a general rule, options are applied to the next specified file. Therefore, order is important, and you can have the same option on the command line multiple times. Each occurrence is then applied to the next input or output file.

Do not mix input and output files -- first specify all input files, then all output files. Also do not mix options which belong to different files. All options apply ONLY to the next input or output file and are reset between files.


 ·   To set the video bitrate of the output file to 64kbit/s:
avconv -i input.avi -b 64k output.avi

  ·   To force the frame rate of the output file to 24 fps: 

avconv -i input.avi -r 24 output.avi

  ·   To force the frame rate of the input file (valid for raw formats only) to 1 fps and the frame rate of the output file to 24 fps:
 avconv -r 1 -i input.m2v -r 24 output.avi

The format option may be needed for raw input files.
 -codecs
           Show available codecs. The fields preceding the codec names have the following meanings:
           D   Decoding available
           E   Encoding available
           V/A/S Video/audio/subtitle codec
           S   Codec supports slices
           D   Codec supports direct rendering
           T   Codec can handle input truncated at random locations instead of only at frame boundaries

Main options
       -f fmt (input/output)
           Force input or output file format. The format is normally autodetected for input files and guessed from file extension for output files, so this option is not needed in most cases.


 -i filename (input)
           input file name

 -y (global)
           Overwrite output files without asking.

-t duration (output)
           Stop writing the output after its duration reaches duration.  duration may be a number in seconds, or in "hh:mm:ss[.xxx]" form.
       -fs limit_size (output)
           Set the file size limit.


       -ss position (input/output)
           When used as an input option (before "-i"), seeks in this input file to position. When used as an output option (before an output filename), decodes but discards input until the timestamps reach position. This is slower, but more accurate. position may be either in seconds or in "hh:mm:ss[.xxx]" form.

   -target type (output)
           Specify target file type ("vcd", "svcd", "dvd", "dv", "dv50"). type may be prefixed with "pal-", "ntsc-" or "film-" to use the corresponding standard. All the format options (bitrate, codecs, buffer sizes) are then set automatically. 
You can just type:
                   avconv -i myfile.avi -target vcd /tmp/vcd.mpg

           Nevertheless you can specify additional options as long as you know they do not conflict with the standard, as in:
                   avconv -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg

       
-aspect[:stream_specifier] aspect (output,per-stream)
           Set the video display aspect ratio specified by aspect. aspect can be a floating point number string, or a string of the form num:den, where num and den are the numerator and denominator of the aspect ratio. For example "4:3",  "16:9", "1.3333", and "1.7777" are valid argument values.


  
 -bt tolerance
           Set video bitrate tolerance (in bits, default 4000k).  Has a minimum value of: (target_bitrate/target_framerate).  In 1-pass mode, bitrate tolerance specifies how far ratecontrol is willing to deviate from the target average bitrate value. This is not related to min/max bitrate. Lowering tolerance too much has an adverse effect on quality.


 -maxrate bitrate
           Set max video bitrate (in bit/s).  Requires -bufsize to be set.

 -minrate bitrate
           Set min video bitrate (in bit/s).  Most useful in setting up a CBR encode:
                   avconv -i myfile.avi -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v
           It is of little use elsewise.


·   You can set several input files and output files:
                   avconv -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg

Converts the audio file a.wav and the raw YUV video file a.yuv to MPEG file a.mpg.

                   avconv -i /tmp/a.wav -map 0:a -b 64k /tmp/a.mp2 -map 0:a -b 128k /tmp/b.mp2

           Converts a.wav to a.mp2 at 64 kbits and to b.mp2 at 128 kbits. '-map file:index' specifies which input stream is used for each output stream, in the order of the definition of output streams.


 ·   You can transcode decrypted VOBs:
   avconv -i snatch_1.vob -f avi -c:v mpeg4 -b:v 800k -g 300 -bf 2 -c:a libmp3lame -b:a 128k snatch.avi

           This is a typical DVD ripping example; the input is a VOB file, the output an AVI file with MPEG-4 video and MP3 audio. Note that in this command we use B-frames so the MPEG-4 stream is DivX5 compatible, and GOP size is 300 which means one intra frame every 10 seconds for 29.97fps input video. Furthermore, the audio stream is MP3-encoded, so you need to enable LAME support by passing "--enable-libmp3lame" to configure.  The mapping is particularly useful for DVD transcoding to get the desired audio language.

 NOTE: To see the supported input formats, use "avconv -formats".


 ·   You can extract images from a video, or create a video from many images:
           For extracting images from a video:
                   avconv -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg 

 This will extract one video frame per second from the video and will output them in files named foo-001.jpeg, foo-002.jpeg, etc. Images will be rescaled to fit the new WxH values.

           If you want to extract just a limited number of frames, you can use the above command in combination with the -vframes or -t option, or in combination with -ss to start extracting from a certain point in time.
           For creating a video from many images:
                   avconv -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi
           The syntax "foo-%03d.jpeg" specifies to use a decimal number composed of three digits padded with zeroes to express the sequence number. It is the same syntax supported by the C printf function, but only formats accepting a normal integer are suitable.



=========================================================================


For more details man avconv.





Monday, 6 May 2013

External Read Me Links

Monitoring:
----------

https://www.elance.com/  [ Find great freelance jobs ]

http://hasgeek.com/

https://groups.google.com/forum/?fromgroups#!forum/algogeeks

http://www.slideshare.net/sudhirpg/ganglia-monitoring-tool

http://www.ibm.com/developerworks/library/l-ganglia-nagios-1/

http://blogs.hbr.org/cs/2013/02/write_e-mails_that_people_wont.html

http://redis.io/

http://redis.io/topics/data-types#strings

http://redis.io/documentation

http://try.redis.io/

http://redis.io/commands

Hadoop Operations:  [http://www.amazon.com/Hadoop-Operations-Eric-Sammer/dp/1449327052/ref=pd_sim_b_1 ]

http://www.tummy.com/articles/isolating-heavy-load/

http://www.tummy.com/

http://www.tutorialspoint.com

http://techpreparation.com/mysql-interview-questions-answers1.htm

http://mysqlboss.blogspot.in/

http://www.iheavy.com/2012/02/26/top-mysql-dba-interview-questions-part-1/

http://mangesh7rhcss.wordpress.com/2010/09/01/mysql-interview-questions/

http://www.techinterviews.com/29-mysql-interview-questions

http://www.sandykadam.com/interview-questions/mysql-interview-questions-part-2/

http://www.webslike.com/Thread-Puppet-System-Administrator-Interview-Questions-Answers

http://isitup.wordpress.com/tag/linux-administrator-interview-questions/

https://ext4.wiki.kernel.org/index.php/Frequently_Asked_Questions

http://www.thegeekstuff.com/2011/05/ext2-ext3-ext4/

http://en.wikipedia.org/wiki/Journaling_file_system

http://www.thegeekstuff.com/2009/01/15-practical-usages-of-mysqladmin-command-for-administering-mysql-server/

http://www.techinterviews.com/29-mysql-interview-questions

http://isitup.wordpress.com/tag/linux-administrator-interview-questions/

http://amitmund.blogspot.in/2013/02/bash-notes.html

https://sites.google.com/site/amitmund/unix_interview_question

http://amitmund.blogspot.in/2013/03/linuxinterviewquestions.html

http://nixcraft.com/linux-software/9693-linux-administrator-interview-questions.html

http://xtremediary.blogspot.in/2010/04/top-100-linux-interview-questions.html

http://www.gointerviews.com/top-50-linux-interview-questions/

http://javarevisited.blogspot.in/2011/05/unix-command-interview-questions.html

http://www.domainavenue.com/faq_dns.htm

http://docs.oracle.com/cd/E19683-01/806-4077/6jd6blbbp/index.html

http://www.cyberciti.biz/tips/determine-block-size-on-hard-disk-quota.html

http://www.cyberciti.biz/faq/unix-linux-shell-remove-delete-empty-lines/




Thursday, 25 April 2013

SRE Interview Questions 4

SRE Interview Questions 4

1. How SSL Certificate works? Give some more details on certificates and https.

2. Can we use single SSL certificate for on shared hosting where, we have multiple domain that is running on a single public IP address.

3. Can you please tell few Dns records types.

4. What is the difference between exec() and fork()

5. Lets say I have a host with 8GB of RAM and one of my application can grow upto 5GB of memory use, and as per my application in some time it do a scp call for some data receive/transfer. But some time its don't work. On the Log it says the can't start the scp. What can be the issue and what type of Architectural decision you will do for this kind of the issue.

6. What is zfs and zpool?

7. what is block and what is chunk?

8. What is the linux boot process?

9. One of the developer said that today my application is working slow, what all you will check for resolve this?

10. Site is slow, what all you will do to resolve this ?

11. What all you will do to fine tune a mysql db?

12. How you can find what are the slow query on a mysql db.

13. How you will find how many connection is there at the mysql?

14. What is the difference between different type of file-systems [ ext3 or ext4 ] example?

15. How DNS works?

16. How the nagios NRPE talk to the nagios Server.


Nagios <-> NRPE Data flow.
--------------------------------------

A. Nagios Server execute check_nrpe command at the nagios server and request the remote host to execute the run the command.

B. The check_nrpe command at nagios-server contact NRPE daemon on the remote host and remote to execute the check-command.

C. The output of the remote command returned back ti broe daemon to the check_nrpe on the nagios server.

Sunday, 10 March 2013

Unix System Calls



     UNIX system calls are used to manage the file system, control processes,
     and to provide interprocess communication.  The UNIX system interface
     consists of about 80 system calls (as UNIX evolves this number will
     increase).  The following table lists about 40 of the more important
     system call:




 GENERAL CLASS              SPECIFIC CLASS                 SYSTEM CALL
     ---------------------------------------------------------------------
     File Structure             Creating a Channel             creat()
     Related Calls                                             open()
                                                               close()
                                Input/Output                   read()
                                                               write()
                                Random Access                  lseek()
                                Channel Duplication            dup()
                                Aliasing and Removing          link()
                                Files                          unlink()
                                File Status                    stat()
                                                               fstat()
                                Access Control                 access()
                                                               chmod()
                                                               chown()
                                                               umask()
                                Device Control                 ioctl()
     ---------------------------------------------------------------------
     Process Related            Process Creation and           exec()
     Calls                      Termination                    fork()
                                                               wait()
                                                               exit()
                                Process Owner and Group        getuid()
                                                               geteuid()
                                                               getgid()
                                                               getegid()
                                Process Identity               getpid()
                                                               getppid()
                                Process Control                signal()
                                                               kill()
                                                               alarm()
                                Change Working Directory       chdir()
     ----------------------------------------------------------------------
     Interprocess               Pipelines                      pipe()
     Communication              Messages                       msgget()
                                                               msgsnd()
                                                               msgrcv()
                                                               msgctl()
                                Semaphores                     semget()
                                                               semop()
                                Shared Memory                  shmget()
                                                               shmat()
                                                               shmdt()
     ----------------------------------------------------------------------

     [NOTE:  The system call interface is that aspect of UNIX that has
     changed the most since the inception of the UNIX system.  Therefore,
     when you write a software tool, you should protect that tool by putting
     system calls in other subroutines within your program and then calling
     only those subroutines.  Should the next version of the UNIX system
     change the syntax and semantics of the system calls you've used, you
     need only change your interface routines.]
 
 
 
 
 
Original Link: http://www.di.uevora.pt/~lmr/syscalls.html