Sophie

Sophie

distrib > Fedora > 17 > i386 > by-pkgid > 675c8c8167236dfcf8d66da674f931e8 > files > 997

erlang-doc-R15B-03.3.fc17.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns:fn="http://www.w3.org/2005/02/xpath-functions">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css">
<title>Erlang -- Introduction</title>
</head>
<body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"><div id="container">
<script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript">
            <!--
              function getWinHeight() {
                var myHeight = 0;
                if( typeof( window.innerHeight ) == 'number' ) {
                  //Non-IE
                  myHeight = window.innerHeight;
                } else if( document.documentElement && ( document.documentElement.clientWidth ||
                                                         document.documentElement.clientHeight ) ) {
                  //IE 6+ in 'standards compliant mode'
                  myHeight = document.documentElement.clientHeight;
                } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
                  //IE 4 compatible
                  myHeight = document.body.clientHeight;
                }
                return myHeight;
              }

              function setscrollpos() {
                var objf=document.getElementById('loadscrollpos');
                 document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2;
              }

              function addEvent(obj, evType, fn){
                if (obj.addEventListener){
                obj.addEventListener(evType, fn, true);
                return true;
              } else if (obj.attachEvent){
                var r = obj.attachEvent("on"+evType, fn);
                return r;
              } else {
                return false;
              }
             }

             addEvent(window, 'load', setscrollpos);

             //--></script><div id="leftnav"><div class="innertube">
<img alt="Erlang logo" src="../../../../doc/erlang-logo.png"><br><small><a href="users_guide.html">User's Guide</a><br><a href="index.html">Reference Manual</a><br><a href="release_notes.html">Release Notes</a><br><a href="../pdf/mnesia-4.7.1.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>Mnesia</strong><br><strong>User's Guide</strong><br><small>Version 4.7.1</small></p>
<br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Chapters</strong></small></p>
<ul class="flipMenu" imagepath="../../../../doc/js/flipmenu">
<li id="loadscrollpos" title="Introduction" expanded="true">Introduction<ul>
<li><a href="Mnesia_chap1.html">
              Top of chapter
            </a></li>
<li title="About Mnesia"><a href="Mnesia_chap1.html#id57488">About Mnesia</a></li>
<li title="The Mnesia DataBase Management System (DBMS)"><a href="Mnesia_chap1.html#id57481">The Mnesia DataBase Management System (DBMS)</a></li>
</ul>
</li>
<li id="no" title="Getting Started with Mnesia" expanded="false">Getting Started with Mnesia<ul>
<li><a href="Mnesia_chap2.html">
              Top of chapter
            </a></li>
<li title="Starting Mnesia for the first time"><a href="Mnesia_chap2.html#id61530">Starting Mnesia for the first time</a></li>
<li title="An Introductory Example"><a href="Mnesia_chap2.html#id62101">An Introductory Example</a></li>
</ul>
</li>
<li id="no" title="Building A Mnesia Database" expanded="false">Building A Mnesia Database<ul>
<li><a href="Mnesia_chap3.html">
              Top of chapter
            </a></li>
<li title="Defining a Schema"><a href="Mnesia_chap3.html#id67814">Defining a Schema</a></li>
<li title="The Data Model"><a href="Mnesia_chap3.html#id68070">The Data Model</a></li>
<li title="Starting Mnesia"><a href="Mnesia_chap3.html#id68125">Starting Mnesia</a></li>
<li title="Creating New Tables"><a href="Mnesia_chap3.html#id72288">Creating New Tables</a></li>
</ul>
</li>
<li id="no" title="Transactions and Other Access Contexts" expanded="false">Transactions and Other Access Contexts<ul>
<li><a href="Mnesia_chap4.html">
              Top of chapter
            </a></li>
<li title="Transaction Properties"><a href="Mnesia_chap4.html#id72980">Transaction Properties</a></li>
<li title="Locking"><a href="Mnesia_chap4.html#id73193">Locking</a></li>
<li title="Dirty Operations"><a href="Mnesia_chap4.html#id73653">Dirty Operations</a></li>
<li title="Record Names versus Table Names"><a href="Mnesia_chap4.html#id74026">Record Names versus Table Names</a></li>
<li title="Activity Concept and Various Access Contexts"><a href="Mnesia_chap4.html#id74114">Activity Concept and Various Access Contexts</a></li>
<li title="Nested transactions"><a href="Mnesia_chap4.html#id74404">Nested transactions</a></li>
<li title="Pattern Matching"><a href="Mnesia_chap4.html#id74476">Pattern Matching</a></li>
<li title="Iteration"><a href="Mnesia_chap4.html#id74822">Iteration</a></li>
</ul>
</li>
<li id="no" title="Miscellaneous Mnesia Features" expanded="false">Miscellaneous Mnesia Features<ul>
<li><a href="Mnesia_chap5.html">
              Top of chapter
            </a></li>
<li title="Indexing"><a href="Mnesia_chap5.html#id75164">Indexing</a></li>
<li title="Distribution and Fault Tolerance"><a href="Mnesia_chap5.html#id75284">Distribution and Fault Tolerance</a></li>
<li title="Table Fragmentation"><a href="Mnesia_chap5.html#id75432">Table Fragmentation</a></li>
<li title="Local Content Tables"><a href="Mnesia_chap5.html#id76375">Local Content Tables</a></li>
<li title="Disc-less Nodes"><a href="Mnesia_chap5.html#id76402">Disc-less Nodes</a></li>
<li title="More Schema Management"><a href="Mnesia_chap5.html#id76560">More Schema Management</a></li>
<li title="Mnesia Event Handling"><a href="Mnesia_chap5.html#id76675">Mnesia Event Handling</a></li>
<li title="Debugging Mnesia Applications"><a href="Mnesia_chap5.html#id77250">Debugging Mnesia Applications</a></li>
<li title="Concurrent Processes in Mnesia"><a href="Mnesia_chap5.html#id77395">Concurrent Processes in Mnesia</a></li>
<li title="Prototyping"><a href="Mnesia_chap5.html#id77432">Prototyping</a></li>
<li title="Object Based Programming with Mnesia"><a href="Mnesia_chap5.html#id77546">Object Based Programming with Mnesia</a></li>
</ul>
</li>
<li id="no" title="Mnesia System Information" expanded="false">Mnesia System Information<ul>
<li><a href="Mnesia_chap7.html">
              Top of chapter
            </a></li>
<li title="Database Configuration Data"><a href="Mnesia_chap7.html#id77779">Database Configuration Data</a></li>
<li title="Core Dumps"><a href="Mnesia_chap7.html#id77817">Core Dumps</a></li>
<li title="Dumping Tables"><a href="Mnesia_chap7.html#id77838">Dumping Tables</a></li>
<li title="Checkpoints"><a href="Mnesia_chap7.html#id77873">Checkpoints</a></li>
<li title="Files"><a href="Mnesia_chap7.html#id78113">Files</a></li>
<li title="Loading of Tables at Start-up"><a href="Mnesia_chap7.html#id78474">Loading of Tables at Start-up</a></li>
<li title="Recovery from Communication Failure"><a href="Mnesia_chap7.html#id78632">Recovery from Communication Failure</a></li>
<li title="Recovery of Transactions"><a href="Mnesia_chap7.html#id78755">Recovery of Transactions</a></li>
<li title="Backup, Fallback, and Disaster Recovery"><a href="Mnesia_chap7.html#id78876">Backup, Fallback, and Disaster Recovery</a></li>
</ul>
</li>
<li id="no" title="Combining Mnesia with SNMP" expanded="false">Combining Mnesia with SNMP<ul>
<li><a href="Mnesia_chap8.html">
              Top of chapter
            </a></li>
<li title="Combining Mnesia and SNMP "><a href="Mnesia_chap8.html#id79691">Combining Mnesia and SNMP </a></li>
</ul>
</li>
<li id="no" title="Appendix A: Mnesia Error Messages" expanded="false">Appendix A: Mnesia Error Messages<ul>
<li><a href="Mnesia_App_A.html">
              Top of chapter
            </a></li>
<li title="Errors in Mnesia"><a href="Mnesia_App_A.html#id79834">Errors in Mnesia</a></li>
</ul>
</li>
<li id="no" title="Appendix B: The Backup Call Back Interface" expanded="false">Appendix B: The Backup Call Back Interface<ul>
<li><a href="Mnesia_App_B.html">
              Top of chapter
            </a></li>
<li title="mnesia_backup callback behavior"><a href="Mnesia_App_B.html#id80051">mnesia_backup callback behavior</a></li>
</ul>
</li>
<li id="no" title="Appendix C: The Activity Access Call Back Interface" expanded="false">Appendix C: The Activity Access Call Back Interface<ul>
<li><a href="Mnesia_App_C.html">
              Top of chapter
            </a></li>
<li title="mnesia_access callback behavior"><a href="Mnesia_App_C.html#id80172">mnesia_access callback behavior</a></li>
</ul>
</li>
<li id="no" title="Appendix D: The Fragmented Table Hashing Call Back Interface" expanded="false">Appendix D: The Fragmented Table Hashing Call Back Interface<ul>
<li><a href="Mnesia_App_D.html">
              Top of chapter
            </a></li>
<li title="mnesia_frag_hash callback behavior"><a href="Mnesia_App_D.html#id80315">mnesia_frag_hash callback behavior</a></li>
</ul>
</li>
</ul>
</div></div>
<div id="content">
<div class="innertube">
<h1>1 Introduction</h1>
  
  <p>This book describes the Mnesia DataBase Management
    System (DBMS). <strong>Mnesia</strong> is a distributed Database Management
    System, appropriate for telecommunications applications and other
    Erlang applications which require continuous operation and soft
    real-time properties. It is one section of the Open Telecom Platform
    (OTP), which is a control system platform for building
    telecommunications applications.</p>

  <h3><a name="id57488">1.1 
        About Mnesia</a></h3>
    
    <p>The management of data in telecommunications system has many
      aspects whereof some, but not all, are addressed by traditional
      commercial DBMSs (Data Base Management Systems). In particular the
      very high level of fault tolerance which is required in many nonstop
      systems,  combined with requirements on the DBMS to run in the same
      address space as the application, have led us to implement a brand new
      DBMS. called Mnesia. Mnesia is implemented in, and very tightly
      connected to, the programming language Erlang and it provides the
      functionality that is necessary for the implementation of fault 
      tolerant telecommunications systems. Mnesia is a multiuser Distributed
      DBMS specially made for industrial telecommunications applications
      written in the symbolic programming language Erlang, which is also 
      the intended target language. Mnesia tries to address all of the data
      management issues required for typical telecommunications systems and
      it has a number of features that are not normally found in traditional
      databases.      <br>

      In telecommunications applications there are different needs 
      from the features provided by traditional DBMSs. The applications now
      implemented in the Erlang language need a mixture of a broad range
      of features, which generally are not satisfied by traditional DBMSs.
      Mnesia is designed with requirements like the following in mind:</p>
    <ul>
      <li>Fast real-time key/value lookup</li>
      <li>Complicated non real-time queries mainly for
       operation and maintenance</li>
      <li>Distributed data due to distributed 
       applications</li>
      <li>High fault tolerance</li>
      <li>Dynamic re-configuration</li>
      <li>Complex objects</li>
    </ul>
    <p>What
      sets Mnesia apart from most other DBMSs is that it is designed with
      the typical data management problems of telecommunications applications
      in mind. Hence Mnesia combines many concepts found in traditional
      databases, such as transactions and queries with concepts found in data
      management systems for telecommunications applications, such as very
      fast real-time operations, configurable degree of fault tolerance (by
      means of replication) and the ability to reconfigure the system without
      stopping or suspending it. Mnesia is also interesting due to its tight
      coupling to the programming language Erlang, thus almost turning Erlang
      into a database programming language. This has many benefits, the
      foremost is that
      the impedance mismatch between data format used by the
      DBMS and data format used by the programming language, which is used
      to manipulate the data, completely disappears.      <br>
</p>
  

  <h3><a name="id57481">1.2 
        The Mnesia DataBase Management System (DBMS)</a></h3>
    
    <p></p>

    <h4>Features</h4>
      
      <p>Mnesia contains the following features which combine to produce a fault-tolerant,
        distributed database management system written in Erlang:
        </p>
      <ul>
        <li>Database schema can be dynamically reconfigured at runtime.
        </li>
        <li>Tables can be declared to have properties such as location, 
         replication, and persistence.
        </li>
        <li>Tables can be moved or replicated to several nodes to improve 
         fault tolerance. The rest of the system can still access the tables 
         to read, write, and delete records.
        </li>
        <li>Table locations are transparent to the programmer. 
         Programs address table names and the system itself keeps track of 
         table locations.
        </li>
        <li>Database transactions can be distributed, and a large number of 
         functions can be called within one transaction.
        </li>
        <li>Several transactions can run concurrently, and their execution is 
         fully synchronized by the database management system. 
         Mnesia ensures that no two processes manipulate data simultaneously.
        </li>
        <li>Transactions can be assigned the property of being executed on 
         all nodes in the system, or on none. Transactions can also be bypassed 
         in favor of running so called "dirty operations", which reduce 
         overheads and run very fast.
        </li>
      </ul>
      <p>Details of these features are described in the following sections.</p>
    
    <p></p>

    <h4>Add-on Applications</h4>
      
      <p>QLC and Mnesia Session can be used in conjunction with Mnesia to produce 
        specialized functions which enhance the  operational ability of Mnesia.  
        Both Mnesia Session and QLC have their own documentation as part
        of the OTP documentation set.  Below are the main features of Mnesia Session
        and QLC when used in conjunction with Mnesia:</p>
      <ul>
        <li>
<strong>QLC</strong> has the ability to optimize the query
         compiler for the Mnesia Database Management System, essentially making
         the DBMS more efficient.</li>
        <li>
<strong>QLC</strong>, can be used as a database programming
         language for Mnesia. It includes a notation called "list
         comprehensions" and can be used to make complex database
         queries over a set of tables.</li>
        <li>
<strong>Mnesia Session</strong> is an interface for the Mnesia Database 
         Management System</li>
        <li>
<strong>Mnesia Session</strong> enables access to the
         Mnesia DBMS from foreign programming languages (i.e. other
         languages than Erlang).</li>
      </ul>
      <p></p>

      <h4>When to Use Mnesia</h4>
        
        <p>Use Mnesia with the following types of applications:
          </p>
        <ul>
          <li>Applications that need to replicate data.
          </li>
          <li>Applications that perform complicated searches on data.
          </li>
          <li>Applications that need to use atomic transactions to 
           update several records simultaneously.
          </li>
          <li>Applications that  use soft real-time characteristics.
          </li>
        </ul>
        <p>On the other hand, Mnesia may not be appropriate with the 
          following types of applications:
          </p>
        <ul>
          <li>Programs that process plain text or binary data files
          </li>
          <li>Applications that merely need a look-up dictionary
           which can be stored to disc can utilize the standard
           library module <span class="code">dets</span>, which is a disc based version
           of the module <span class="code">ets</span>. 
          </li>
          <li>Applications which need disc logging facilities can
           utilize the module <span class="code">disc_log</span> by preference.
          </li>
          <li>Not suitable for hard real time systems.
          </li>
        </ul>
      
    

    <h4>Scope and Purpose</h4>
      
      <p>This manual is included in the OTP document set. It describes
        how to build Mnesia database applications, and how to integrate
        and utilize the Mnesia database management system with
        OTP. Programming constructs are described, and numerous
        programming examples are included to illustrate the use of
        Mnesia.
        </p>
    

    <h4>Prerequisites</h4>
      
      <p>Readers of this manual are assumed to be familiar with system
        development principles and database management systems. Readers
        are also assumed to be familiar with the Erlang programming
        language.</p>
    

    <h4>About This Book</h4>
      
      <p>This book contains the following chapters:
        </p>
      <ul>
        <li>Chapter 2, "Getting Started with Mnesia", introduces
         Mnesia with an example database. Examples are shown of how to
         start an Erlang session, specify a Mnesia database directory,
         initialize a database schema, start Mnesia, and create
         tables. Initial prototyping of record definitions is also
         discussed.
        </li>
        <li>Chapter 3, "Building a Mnesia Database", more formally
         describes the steps introduced in Chapter 2, namely the Mnesia
         functions which define a database schema, start Mnesia, and
         create the required tables.
        </li>
        <li>Chapter 4, "Transactions and other access contexts",
         describes the transactions properties which make Mnesia into a
         fault tolerant, real-time distributed database management
         system. This chapter also describes the concept of locking in
         order to ensure consistency in tables, and so called "dirty
         operations", or short cuts which bypass the transaction system
         to improve speed and reduce overheads.
        </li>
        <li>Chapter 5, "Miscellaneous Mnesia Features", describes
         features which enable the construction of more complex
         database applications. These features includes indexing,
         checkpoints, distribution and fault tolerance, disc-less
         nodes, replication manipulation, local content tables, concurrency,
         and object based programming in Mnesia.
        </li>
        <li>Chapter 6, "Mnesia System Information", describes the
         files contained in the Mnesia database directory, database
         configuration data, core and table dumps, as well as the
         important subject of backup, fall-back, and disaster recovery
         principles.
        </li>
        <li>Chapter 7, "Combining Mnesia with SNMP", is a short
         chapter which outlines  Mnesia  integrated with SNMP.
        </li>
        <li>Appendix A, "Mnesia Errors Messages", lists Mnesia error
         messages and their meanings.
        </li>
        <li>Appendix B, "The Backup Call Back Interface", is a
         program listing of the default implementation of this facility.
        </li>
        <li>Appendix C, "The Activity Access Call Back Interface",
         is a program outlining of one possible implementations of this facility.
        </li>
      </ul>
    
  
</div>
<div class="footer">
<hr>
<p>Copyright © 1997-2012 Ericsson AB. All Rights Reserved.</p>
</div>
</div>
</div></body>
</html>