Benutzer-Werkzeuge

Webseiten-Werkzeuge


nosql:admin_console_oracle_nosql_db_11gr2

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
Letzte ÜberarbeitungBeide Seiten der Revision
nosql:admin_console_oracle_nosql_db_11gr2 [2013/07/04 18:03] gpipperrnosql:admin_console_oracle_nosql_db_11gr2 [2013/07/26 16:17] gpipperr
Zeile 1: Zeile 1:
-===== Die Befehle der Admin Konsole der Oracle NoSQL DB im eigenen Programm integrieren ===== 
  
-Über die Klasse CommandServiceAPI kann auch im eigenen Programmcode auf die Befehle der Admin Konsole der NoSQL Datenbank zugegriffen werden. 
- 
-=== Initialisieren === 
- 
-<code java> 
- 
-.. 
-    public static CommandServiceAPI csi = null; 
-    public static String adminNode = "localost"; 
-    public static int adminPort = 5000; 
-.. 
-    /** 
-      init the Command API 
-     */ 
-    public static void init(String nodeName, int RMIPort) { 
-        log("     =============Get PerfMap Demo =========================="); 
-        try { 
-            if (csi == null) { 
-                csi = RegistryUtils.getAdmin(nodeName, RMIPort); 
-            } 
- 
-        } 
-        catch (Exception ex) { 
-            log(ex.toString()); 
-        } 
- 
-    } 
-</code> 
- 
-Beispiel für den Aufruf der Performance Statistik ohne den lästigen Header der Amin Konsole: 
- 
-<code java>     
- 
-    /** 
-     * show the performance Satistik of the KStore 
-     */ 
- 
-    public static void showPerfStat() { 
- 
-        log("     =============Get PerfMap Demo =========================="); 
-        try { 
-            if (csi == null) { 
-                init(adminNode, adminPort); 
-            } 
- 
-            Map<ResourceId, PerfEvent> perfmap = csi.getPerfMap(); 
- 
-            for (PerfEvent pe : perfmap.values()) { 
-                System.out.println(pe.getColumnFormatted()); 
-            } 
-        } 
-        catch (Exception ex) { 
-            log(ex.toString()); 
-        } 
- 
-        log("     =============Get PerfMap Demo =========================="); 
-    } 
-     
-</code> 
- 
-Beispiel für die Anzeige der Topology: 
-<code java>     
-    /** 
-     * show the Topology Overview of the KStore 
-     */ 
-     
-        public static void showTopology(){ 
-         
-        log("     =============show Part Map =========================="); 
-         
-        try { 
-             
-            if (csi == null) { 
-                init(adminNode, adminPort); 
-            }            
-             
-            Topology topo = csi.getTopology(); 
-            PartitionMap part = topo.getPartitionMap(); 
-            
-            for (Topology.Component com :  part.getAll()) { 
-                System.out.println(com.toString()); 
-            } 
-            for ( StorageNode sn : topo.getSortedStorageNodes() ){ 
-                System.out.println("Read from "+ sn.getStorageNodeId() +" read :: "+sn.toString());                 
-            } 
-             
-        } 
-        catch (Exception ex) { 
-            log(ex.toString()); 
-        } 
- 
-        log("     =============show Part Map =========================="); 
-         
-    } 
- 
-</code> 
- 
-=== Beispiel für eine Anzeige des Status der einzelnen Nodes in einer CSV Sicht === 
- 
-<code java> 
- 
-    public static CommandServiceAPI csi = null; 
-    public static String adminNode = "localost"; 
-    public static int adminPort = 5000; 
- 
- 
-    /** 
-      init the Command API 
-     */ 
-    public static void init(String nodeName, int RMIPort) { 
- 
-        try { 
-            if (csi == null) { 
-                csi = oracle.kv.impl.util.registry.RegistryUtils.getAdmin(nodeName, RMIPort); 
-            } 
- 
-        } catch (Exception ex) { 
-            System.out.println(ex.toString()); 
-        } 
- 
-    } 
- 
-    public static void showTopology() { 
- 
-        try { 
- 
-            if (csi == null) { 
-                init(adminNode, adminPort); 
-            } 
- 
-            // get the topo 
- 
-            Topology topo = csi.getTopology(); 
- 
-            //register util 
-            RegistryUtils regUtils = new RegistryUtils(topo); 
- 
-            // grep the status 
-            ServiceStatus status = ServiceStatus.UNREACHABLE; 
-            // For all Storage Nodes 
-            StorageNodeStatus snStatus = null; 
-            StorageNodeAgentAPI sna = null; 
- 
-            RepNodeStatus rnStatus = null; 
-            RepNodeAdminAPI rna = null; 
-            String repRole = "MASTER"; 
- 
-            for (StorageNode sn : topo.getSortedStorageNodes()) { 
-                sna = regUtils.getStorageNodeAgent(sn.getStorageNodeId()); 
-                snStatus = sna.ping(); 
-                status = snStatus.getServiceStatus(); 
-                System.out.printf("nosqlTopo=%s|%s|%s|null\n",sn.getStorageNodeId(),sn.toString(),status); 
- 
-                RepGroupMap snrepgrp = topo.getRepGroupMap(); 
-                for (RepGroup r : snrepgrp.getAll()) { 
-                    for (RepNode rn2 : r.getRepNodes()) { 
-                        rna = regUtils.getRepNodeAdmin(rn2.getResourceId()); 
-                        rnStatus = rna.ping(); 
-                        status = rnStatus.getServiceStatus(); 
-                        if (sn.getStorageNodeId().equals(rn2.getStorageNodeId())) { 
- 
-                            if (rnStatus.getReplicationState().isMaster()) { 
-                                repRole = "MASTER"; 
-                            } else { 
-                                repRole = "REPLICA"; 
-                            } 
- 
-                             System.out.printf("nosqlTopo=%s|%s|%s|%s\n",rn2.toString(),r.toString(),status,repRole); 
-                        } 
-                    } 
-                } 
- 
-            } 
- 
-        } catch (Exception ex) { 
-            System.out.println(ex.toString()); 
-        } 
- 
-</code> 
nosql/admin_console_oracle_nosql_db_11gr2.txt · Zuletzt geändert: 2013/07/26 16:18 von gpipperr