Mysql replication delay
September 29, 2011
For a project that I participate we wanted to evaluate the use of MySQL replication for horizontal scaling. The application wasn’t designed with scaling in mind, and make a heavy usage of the database (in a number of not so efficient ways). Replication seemed like a good solution since there would be only a master server (actually in the setup there is a second server waiting (using heartbeat) in case the first one fails, with drbd to keep them in sync) where all the writes would go, and a number of slaves for the read access. The question that eventually came up was how long whould the replicatin take?
Αλόννησος Survival Guide
August 3, 2011
Μετά από super διακοπές στην Αλόννησο παραθέτω μερικά tips από την προσωπική μου εμπειρία. Δεν υπάρχει σειρά είναι όπως μου έρχονται:
- Η θάλασσα είναι απίστευτη!! Η πρώτη αίσθηση που είχα ήταν σαν το Ντόρνα! Δεν κάνεις μπάνιο σε νερό, αλλά σε βιλούδο!!
- Τα νερά επίσης είναι κρυστάλλινα και βλέπεις από επιφάνεια σε πολύ μεγάλο βάθος! ΑΠΑΡΑΙΤΗΤΑ για τους φίλους : Μάσκα, αναπνευστήρας. Προεραιτικά τα βατραχοπέδιλα (στα 2m βλέπεις αρκετά ψάρια).
- Αν φυσάει από Δυτικούς ως και Νότιους προτιμάμε την Ανατολική πλευρά του νησιού.
- Αν κάνετε αυτόνομη κατάδυση (και το επιτρέπουνε) να πάτε να δείτε! (Στην Αλόννησο υπάρχουνε 2 καταδυτικά κέντρα. Ένα στο Πατητήρι και ένα στη Στενή Βάλα). Μεγάλη βλακεία που δεν επιτρέπουνε γενικά την αυτόνομη κατάδυση, κάπως θα έπρεπε να το οργανώσουνε καλύτερα σε συνεργασία με το θαλάσσιο πάρκο.
- Ρουσούμ Γυαλό πάτε άνετα με τα πόδια, ρωτήστε όμως που είναι το μονοπάτι που κόβει δρόμο (μετά τα σχολεία πάτε δεξιά) για να μην περπατάτε άδικα
- Καλύτερη παραλία το Κοκκινόκαστρο! (μετά τα Γυάλια)
- Παραλία με άμμο και περπάτημα στη θάλασσα η Χρυσή Μηλιά! Εκεί πέρα αν αφού κατεβείτε πάτε τέρμα αριστερά (όπως κοιτάτε την θάλασσα) τότε θα πάτε στο δεύτερο κομμάτι της παραλίας που είναι ένα ξενοδοχείο με τίγκα Ιταλούς! Αν δεν σας πειράζουνε οι Ιταλοί που κάνουνε aquarobic και διάφορα μπορείτε να καβατζώσετε στο τζάμπα ξαπλώστρες και ομπρέλα. Καπουτσίνο ΔΕΝ παίρνουμε από την καντίνα.
- Βόλτα με καραβάκι γύρω είναι must. Προτιμάμε το “Στέλλα” διότι ο κ. Παναγιώτης έχει πολύ φάση, και επίσης στη Μεγάλη Σπηλιά μπαίνει όλο μέσα και κάνεις από εκεί πανω βουτιά!! (Απίστευτη η Μεγάλη Σπηλιά).
- Συγκοινωνία (δηλαδή Λεωφορείο) ξεχάστε το σχεδόν. Απλά υπάρχει για μπορούνε να το δείχνουνε. Υπάρχουνε μόνο 2 προορισμοί (Πατητήρι – Χώρα και Πατητήρι – Στενή Βάλα) και τα δρομολόγια είναι ΠΟΛΥ αραιά. Έχει και μια μεγάλη διακοπή το μεσημέρι (όπως και τα περισσότερα πράγματα που κλείνανε το μεσημέρι) και το βράδυ σταματάει και νωρίς (για την Χώρα πάντα). Άρα πάμε σε πιο κάτω λύσεις που παρουσιάζονται.
- Αμάξι είναι η πονεμένη ιστορία! Πραγματικά το μόνο που μου έσπασε τα νεύρα. Βρίσκεται δύσκολα αμάξι και οι τιμές αλλάζουνε μέρα με την μέρα (και είναι και μερικές στο Θεό) διότι βλέπουνε τον κόσμο και τις ανεβοκατεβάζουνε. Δείτε τα ζώδια πρίν πάτε .. αν ο Ερμής είναι ανάδρομος μην το επιχειρήσετε.
- Αν όχι αμάξι τα μηχανάκια είναι μια καλή λύση, υπάρχουνε πολλά! Προσοχή στον (ανύπαρκτο σε πολλά σημεία) δρόμο.
- Καλύτερη λύση και από τα 2: Να πάτε με σκάφος!!! Έχει τόσο όμορφα μέρη για να δεί κανείς που δεν πάει οδικώς. Επίσης και 2-3 νησιά γύρω γύρω.
- (Αν πάτε για πολλές μέρες τότε ίσως αξίζει να πάρετε το δικό σας, αλλά πάλι δείτε τα δρομολόγια)
- Φαγητό ΑΡΙΣΤΟ! Στο Πατητήρι για ψάρι στο Αρχιπέλαγος και για σουβλάκι στο Στέκι (δίπλα ακριβώς). Στη Χώρα must το Περι Ορέξεως (σίγουρα δοκιμάστε το γεμιστό μπιφτέκι με γραβιέρα και το burger του, ο μάγειρας είναι καλλιτέχνης) και για γλυκό ΚΑΡΑMUST το Χαγιάτι! (Σοκολατόπιτα μιαμ μιαμ)
- “Night life” (καλά μην περιμένετε τίποτα τρελλό στην Αλόννησο) στη Χώρα. Το Πατητήρι έχει 2 μαγαζιά το Εν Πλώ δεξιά όπως κοιτάς το λιμάνι και τον Λίθο στα αριστερά. Σε θέα και μουσική πάντως δεν συγκρίνονται με το Χαγιάτι! Προτιμήσαμε Λίθο για καφέ όταν πήγαμε στο Πατητήρι και φτιάξανε άριστο φραπέ με παγωτό!
Και ότι άλλο θυμηθώ το συμπληρώνω
Number of online users script for OpenVPN
July 6, 2011
We wanted to create a graph (using rrd) that monitors the number of online users of our OpenVPN setup. The solutions where:
- retrieve the status file created by OpenVPN to the RRD server and parse it locally
- execute a small script that parses the status file and reports the number of users. The result can be available to the RRD server though the network with the use of inetd(8)
- use the management interface for OpenVPN to get the same information
Each solution had some drawbacks. The best solution seemed to be 3) but this had a number of problems.
- the management interface is still unencrypted, so it is easy to sniff the password
- there is no way to restrict the commands that can be executed through the management interface (someone with access to the management interface can disable the service)
- the tun interfaces on Solaris (don’t even ask me why we have Solaris as the VPN Gateway) are not “complete” network interfaces, so you cannot really filter traffic passing through them with ipfilter. (that’s what the local Solaris guru said). So even if we used another physical interface for the management service to run, the vpn users could also access the management interface port.
For the above reasons I was quite reluctant to enable as is the management interface. The final solution came with a combination of solutions 2) and 3).
I had the OpenVPN management interface run on localhost (so that none outside the machine can touch the interface) and had a small script run through inetd , connected to the management interface and return the number of online users as a number.
OpenVPN routing problems on Solaris
July 5, 2011
We use OpenVPN on Solaris 9 as our VPN service to users using tun interfaces. After a long time we decided to upgrade to the latest version (together with our home-made auth_ldap authentication module). This post applies to version 2.2.1 (yet no official release announcement) but also applies to version 2.2.0.
After the installation the service seemed to go up, the user authentication worked but it was not possible for packets to pass through. The problem happened because for some reason after the initialisation openvpn removed the routing entries for the VPN subnet that should go through the tun interface.
After a more careful look at the log files the problem was during the initialisation. It added the routes with the corresponding route add net … but after the fork the routes where deleted with route del commands. The first “fix” was to add a line to the init script to manual add a route after the vpn was up.
Having a look at the source code, the problem was at the openvpn_exit() function that called the tun_abort() (which called do_close_tun() and delete_routes()) after the fork. Searching also in the trac found this link : https://community.openvpn.net/openvpn/ticket/53 that describes also the same behaviour.
The final solution was to produce a patch as described in the above link, and use this source code patch for the building of OpenVPN.
So people that have OpenVPN in tun mode at least in Solaris (haven’t tried it on Linux) and after an upgrade suddenly realise that things don’t work as supposed to, they should first try to add the routing command by hand with
route add vpn_subnet vpn_subnet_mask vpn_gateway_ip
and if this fixes the problem, then try to apply the solution found on the OpenVPN track
Mapping a network drive with a greek name share
February 21, 2011
I ‘m misfortunate enough to have to administer a Windows network, with an AD forest. Right now we are in the point that we have to migrate fileservers. Since the previous setup bonded the fileserver with exact server name, moving the file server around is not the most easy task. (All the users should update their links to the shared files, etc, etc, it is going to be a long week). In order not to repeat the whole procedure in the future, I proposed to use a map to a network drive. The server can change, the map to the network drive can change, but the users will notice nothing since their shortcuts will always be on the same network drive.The mapping can be done using group policies, so everything will be setup for the user.
While I was trying to implement this setup using group policies, the simple batch file[1] I created to add the network mapping was failing. The batch file had just command
net use z: \\server\όνομα
After some search I found that the reason this didn’t work, was that batch files cannot understand greek names (for encoding reasons). I tried a number of options to create a batch file that worked, but all failed. Finally, I opened the command prompt and typed the command :
echo “net use z: \\server\όνομα” > file.bat
This file worked
. I even opened notepad and added some extra stuff that I needed, and still everything works. Moral of the story : Sometimes the unix way, works even in Windows :p
[1] I have read that Mapping Network Drives can be done in windows 2008 using the new policies, but the clients are all Windows XP, and I’m not willing to go to one by one to all the workstations and install manually the needed updates (no central update pushing here). Also people might argue against using a batch file, but batch files is the thing that I know at the moment. (I’m also sure that there is a better way to create the needed file, but this way worked for me).
Undernet IRC server .. phising ..
May 31, 2010
Το ΣΚ ήρθε το εξής email:
From : o25ybo@otenet.gr
Είμαι φοιτητής της ιατρικής σχολής και επικοινωνώ μαζί σας σχετικά με μία πρόταση που θέλω να παραθέσω.
Θέλω να σας ρωτήσω εαν ενδιαφέρεστε να φιλοξενήσετε IRC διακομηστή για το IRC δίκτυο της Undernet.
Τα οφέλη του ΚΛΕΙΔΙ απο αυτή τη φιλοξενία είναι η προβολή σε διεθνές επίπεδο του τεχνολογικού υπόβαθρου του πανεπιστημίου Αθηνών καθώς το UnderNet ειναι το δεύτερο μεγαλήτερο IRC δίκτυο παγκοσμίως.
Αυτό που χρειάζεται είναι ένα σύστημα στις τεχνολογικές εγκαταστάσεις του Πανεπιστημίου Αθηνών και πλήρης άδεια απο το ΚΛΕΙΔΙ για να συνδεθεί ο διακομηστής με τους κεντρικούς IRC διακομηστές του UnderNet
Μπορούμε να αναλάβουμε την εξόφληση του hardware οσον αφορά αυτό το project.
Αναμένω την απάντησή σας.
Με εκτίμηση
Αλέξανδρος Κούκουλας
Το ενδιαφέρον είναι πώς το ίδιο ΑΚΡΙΒΩΣ email στάλθηκε και σε άλλα 2 ιδρύματα από ότι έμαθα. Τελικά υπάρχουνε και διπλοθεσίτες στα ελληνικά πανεπιστήμια. :p
Στάβλος … καφέ για ζώα …
May 31, 2010
Είχαμε πάει με 2 φίλους για καφέ και είχανε την φαεινή ιδέα να πάμε Θησείο. Τελικά καταλήξαμε να πάμε στο Στάβλο, μία απο τις γνωστές καφετέριες της περιοχής. Αν και ουσιαστικά όταν πήγαμε είμασταν σχεδόν μόνοι μας, το service ήταν σε φάση “βαριόμαστε τώρα, αλλά ας φέρουμε τον καφέ”. Οκ λογικό πλέον στα “in μέρη”.
Το καταπληκτικό ήρθε όταν πήγαμε να πληρώσουμε. 12Ε λογαριασμός (για 4 καφέδες). Του δίνουμε 20, στραβομουτσουνιάζει
-”Δεν έχετε ψιλά”.
-”Όχι δεν έχουμε.”
-”Καλά”
Αφήνει 7Ε ρεύστα .. και φεύγει.
Λόγο του σηκωνόμασταν να φύγουμε κτλ κτλ δεν το πήρα χαμπάρι αμέσως, αλλά όταν μοιράζαμε τα ρέστα έξω τότε φάνηκε ότι μας έλειπε το 1Ε. Κορυφαίος ο σερβιτόρος, πήρε και το πουρμπουάρ που θεώρησε ότι του αναλογεί και ύφος 1000 καρδιναλλίων. *$$*#($*#
-1 μέρος που πάω για καφέ.
This is a quick how-to post in order to deploy a python mapping script to oracle virtual directory 11g using weblogic manager.
- Upload the python script to weblogic server (using scp, ftp,whatever)
- locate the ovdconf/mapping_templates directory under the $MW_HOME
- move the script to this directory
- IF you are logged in Weblogic manager, logout and log back in. Otherwise you will not be able to see in Mapping Templates the new Template (and there is no reload button there!*$#(*$#($* )
- go to mapping templates, click on the new script .. and deploy
This made the trick. However regarding Python script support keep in mind the following from the documentation:
"The mapping information in this chapter is included for historical purposes."
The case is like this: You have a brand new Oracle Virtual Directory (11g) and you want it to connect to an Oracle 8i directory. First attempt is to install the Oracle JDBC drivers. After downloading the proper JDBC driver (ojdbc6.jar) for the installed JDK and installing it, you realized that this driver doesn’t support oracle 8i. After some search you find the old version that supports Oracle 8i named classes12.jar. You install it, but nothing happens. Only the very informative error message that there was a connection error. The logs say nothing. You remove all the jdbc drivers from the instance .. checking the logs to see some error message. Nothing happens. Everything as usual. If you try to connect with another not installed jdbc driver to any database, the logs are full of java errors. With Oracle database, no errors?? WTF?!?!
The reason is simple. Oracle’s OVD comes with ojdbc6.jar preinstalled, but it is not in the normal directory that all the other jdbc drivers of the instance are installed, but it is in $MIDDLEWARE_HOME/Oracle_IDM1/jdbc, so it uses this.
The solution to connect is to go to this directory, remove all the jar files and then upload the old ojdbc though weblogic manager. (or you can always just put it using cp to $MIDDLEWARE_HOME/$INSTANCE/OVD/ovd1/plugins/lib).
At least with this way it connects to the database. Whether the mappings are working or not, is something to be checked.
Another possible solution, is to install an oracle 11g listener to the oracle 8i database (someone told me that this is possible) and then use this listener to use the database.
“Commandless” ssh key
May 7, 2010
I just wanted to create an ssh key that can be used only for port forwarding and the user couldn’t login to the machine.
I think as a first attempt i managed to do that, just by putting the following options to the public part of the key and then adding it to .ssh/authorized_keys. The 2 options are: command=”",no-pty
Port forward seems to work ok, and no matter which command i try to execute nothing happens.